A brief introduction to using HomeBrew to install Python 3.* version on Mac and set it to the default value
1. First check the python that comes with Mac, you can see that it is 2.7 .10 version
2. Check the installation package of python3
brew search python3
3. Install python3
brew install python3
You can see the actual version of python3 The installation directory is /usr/local/Cellar/python3/3.6.2
4. Open the configuration file and write python’s external environment variable
open ~/.bash_profile export PATH=${PATH}:/usr/local/Cellar/python3/3.6.2/bin
5. Rename python
alias python="/usr/local/Cellar/python3/3.6.2/bin/python3.6"
6. Let the configuration file take effect
source ~/.bash_profile
7. Use the python command to check
python
8. If the setting is not successful, use which python3 to check whether the location of Python3 is correct at this time. If not, Repeat steps 4, 5, and 6 correctly
which python3
For more Python related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of How to install python3 in mac. For more information, please follow other related articles on the PHP Chinese website!