A brief introduction to installing Python version 3.* on Mac using HomeBrew and setting it to defaults
1, first check the Mac comes with python, you can see that it is the version of 2.7.10
2、View python3 installation package
If you don't have Homebrew installed, please refer here to install it.The right way to install Homebrew on a Mac
brew search python3
3. Install python3
brew install python3
You can see that the actual installation directory for python3 is /usr/local/Cellar/python3/3.9
4. Open the configuration file and write python's external environment variables
open ~/.bash_profile export PATH=${PATH}:/usr/local/Cellar/python3/3.9/bin
5. Rename python
alias python="/usr/local/Cellar/python3/3.9/bin/python3"
6. Let the configuration file take effect
source ~/.bash_profile
7. Use the python command to view
python
8, if not set up successfully then use which python3 to see if the position of Python3 is correct at this time.
If incorrect repeat steps 4, 5, 6
which python3
This is the end of this article about installing python3 on Mac using HomeBrew. I hope it will be helpful for your learning and I hope you will support me more.