mac system installation Python3 initial experience
- 2020-06-19 10:59:28
- OfStack
At the forefront of
For iOS development, do not disassemble the Python that comes with the system, because many library still use Python2.7.
1 installation Xcode
Search for and install Xcode
1.2 Install Xcode command line tool
1.2.1 Open the command line terminal tool
control + space
The input terminal
enter
1.2.2 Install Xcode command line tool
xcode-select --install
Install the suite management tool Homebrew
2.1 installation Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.2 Check whether the installation is successful
brew doctor
The installation Python
brew install python
4. Set path (optional)
If you do not set the path, python will default to the system. (This is not implemented specifically, so this needs to be tried by yourself.)
## Modify the /etc/paths , /usr/local/bin Let's move it up here
sudo vim /etc/paths
Development:
See what path is currently.
Purpose of PATH:
Tell the department where our brew is. It looks up from the top down.
echo $PAHTH
5 Confirm installation
// System by itself python2.7 Directory for /usr/bin/python
which python
//brew The installation of the python3.4, Directory for /usr/local/bin/python3
which python3
6 use
Action 4 not performed (recommended)
// System by itself
python a.py
//brew The installation of the
python3 a.py
Perform operation 4
// System by itself
/usr/bin/python a.py
//brew The installation of the
python a.py
7 installation pip
Python 2.7 or above will be installed automatically with pip. The system comes with python without pip, only easy_install
xcode-select --install
0
Using pip
xcode-select --install
1
conclusion