Article directory
Basic environment introduction
Mac version: macOS Monterey 12.6
Terminal environment: zsh
Installation tool: homebrew
Install python3.9
Use home brew to install the specified version of python
brew install [email protected]
After installation, use the command line to check whether the installation is successful. The figure below indicates that the installation is successful
python3.9
Configure Quick Start
How to reach the input python
to start the specified version of python?
Answer: Configure the environment variable to make the startup.
If you do not need to start in this way, you can directly use the specified version in the pythonx.x way.
Check the environment variable file of this machine, here you can directly see the prompt of your command line terminal, here I use zsh to configure the environment variable, other environments are similar.
Check the installation of python according to the operation prompt in the figure below
Open and edit the zsh variable file
open -e ~/.zshrc
Write the configuration path, ⚠️ Please make changes according to your actual environment
export PATH=$PATH:/usr/local/Cellar/[email protected]/3.9.16/bin
alias python="/usr/local/Cellar/[email protected]/3.9.16/bin/python3.9"
Configuration diagram display
After the configuration is complete, enter the command to load the variable file to make it take effect
source ~/.zshrc
Finally, enter python
the version specified by the configuration to start