我已经使用macports安装了python(以及来自macports的一些其他python包)。与macports一起安装的python可执行文件位于/opt/local/bin/python-2.7
,而mac附带的可执行文件是/Library/Frameworks/Python.framework/Versions/2.7/bin/python
。
如何切换到安装了macports的版本?
答案 0 :(得分:1)
使用port select
命令:
$ port select --list python
Available versions for python:
none
python25-apple
python26-apple
python27 (active)
python27-apple
python33
python34
$ python
Python 2.7.8 (default, Jul 5 2014, 20:17:23)
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ sudo port select --set python python34
Password:
Selecting 'python34' for 'python' succeeded. 'python34' is now active.
$ python
Python 3.4.1 (default, May 21 2014, 21:17:51)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
答案 1 :(得分:-1)
在您的终端中输入:
export PATH="/opt/local/bin:${PATH}"