Mac comes with Python, if you need to view the version, open terminal to enter the following command:
Python--version
If you need to install a new version of Python, there are several ways to install, the first is to go to the Python website to download the installation files, or use the source code compiled (this is not very common), recommended to use homebrew for installation. If you don't know what homebrew is. It is recommended to take a look at its official website: http://brew.sh; to be precise, homebrew complements the Linux-like installation package Manager that Mac does not have, and is exceptionally convenient to use. Use the following command to install:
" $ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) "
Where-E is for Ruby to execute the download code, homebrew is written using Ruby. After the installation is complete, use the following command to determine if homebrew is installed correctly:
Brew Doctor
If the your system is a ready-to-brew. proves that the installation was successful
Execute the following command to install the Python version you need, such as Python3:
Install Python3
You can use the previous command to view the version of Python that is installed.
Sometimes you may also want to see where the different Python versions are located, using the following command to query:
Type-a python (x) x refers to the version you want to query, such as Type-a Python3
The Windows system can be installed directly by downloading the Python image on the website, and the Linux system can be installed using installation methods such as Apt-get install, which is not discussed here.
Python environment build on Mac