SoFunction
Updated on 2025-03-05

Summary of the next steps and precautions that can be done after the python installation is completed

Once Python 3 is installed, you can start programming and development using it. Here are some next steps and precautions that can be done after installation:

Verify installation

Check Python version

  • Open the Terminal application.
  • enterpython3 --version, the Python3 version number installed should be displayed.

Check the pip version(Python's package management tool):

enterpip3 --version, the version number of pip3 should be displayed and corresponds to the Python3 version.

Configuration environment (optional)

While Homebrew usually handles environment variable configurations automatically, you may need to manually adjust them in some cases.

Confirm the paths of Python and pip

enterwhich python3andwhich pip3, confirm that they point to the correct installation path (usually/usr/local/bin/python3and/usr/local/bin/pip3)。

Adjust PATH environment variables(If necessary):

If the path to Python or pip is not set correctly, you may need to edit your shell configuration file (e.g.~/.bash_profileor~/.zshrc) and add the correct path to the PATH.

Install Python package

Use pip3 to install the Python package you need.

Install a package

pip3 install Package name

Upgrade a package

pip3 install --upgrade Package name

List installed packages

pip3 list

Create and run Python scripts

Create Python scripts

  • Create a new file using a text editor with the file extension.py(For example)。
  • Write Python code in a file.

Run Python scripts

  • Open Terminal.
  • Navigate to the directory containing your script.
  • enterpython3 script name.pyto run the script (e.g.python3 )。

Virtual environment (optional)

To isolate dependencies from different projects, you can use Python's virtual environment.

Create a virtual environment

python3 -m venv myenv

(WillmyenvReplace with the virtual environment name you want)

Activate the virtual environment

For bash users:

source myenv/bin/activate

For zsh users:

source myenv/bin/

(If not, then useactivate

Install packages in a virtual environment

pip install Package name

Exit the virtual environment

deactivate

Things to note

  • Make sure your system has been updated to the latest version for compatibility with the latest versions of Python and pip.
  • If you are using an older version of macOS and are having problems related to Python or pip, consider upgrading your operating system or looking for solutions specific to your version.
  • Regularly update the Python packages you installed to ensure you are using the latest version and fix known security vulnerabilities.

This is the article about the following steps and precautions that can be taken after the python installation is completed. For more related operations after the python installation is completed, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!