现在,MacOSX预装了python2,他们把它放在/usr/local/bin中,就可以使用它了,而这个位置已经在系统路径中。在
如果安装任何新版本,如Python3+,它将安装在/Library/Frameworks/Python.framework/Versions//bin/上。在
例如,在我的例子中,完整路径是/Library/Frameworks/Python.framework/Versions/3.6/bin/python3&;/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6。在
我已经用自制软件安装了Python3.6。在
以下是我的终端的有用日志。请看一下。在» Versions check with path (which python)Rishikeshs-MacBook-Air:~ hygull$ which python
/usr/local/bin/python
Rishikeshs-MacBook-Air:~ hygull$which python3
^{pr2}$
which python3.6Rishikeshs-MacBook-Air:~ hygull$ which python3.6
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
Rishikeshs-MacBook-Air:~ hygull$» Start & exit (python2, default installation on MAC OS X)
pythonRishikeshs-MacBook-Air:~ hygull$ python
Python 2.7.15 (default, Jan 12 2019, 21:07:57)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
Rishikeshs-MacBook-Air:~ hygull$python3Rishikeshs-MacBook-Air:~ hygull$ python3
Python 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 03:02:14)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit()
Rishikeshs-MacBook-Air:~ hygull$python3.6
(Same as above but useful if you have two python3+, e.g. if you have python3.6 & python3.7 installed & you want to work with python3.6)Rishikeshs-MacBook-Air:~ hygull$ python3.6
Python 3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 03:02:14)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>