2013-10-18 30 views
0
[mac-120183:/opt/local/bin] name% sudo port select --set python python33 
Selecting 'python33' for 'python' succeeded. 'python33' is now active. 
[mac-120183:/opt/local/bin] name% python 
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 
[mac-120183:/opt/local/bin] name% which python 
/usr/bin/python 
[mac-120183:/opt/local/bin] name% which python3.3 
/opt/local/bin/python3.3 

当我输入python在命令行中使用交互模式时,如何将python切换到python3.3?如何更改macports中的python版本(交互模式)?

感谢

回答

0

你的解释,当你键入python包含在OS X,这意味着OS X编写会期望python是Python 2.7版程序。改变这是危险的,因为它可能会破坏程序,这可能是为什么macports不会搞砸它。

如果你真的想,你可以通过把MacPorts的bin目录/usr/bin前将PATH做到这一点:

export PATH=/path/to/macports/bin:$PATH 

您应该能够找到正确的路径以which python33

你也可以用指向Python 3.3的链接覆盖/usr/bin/python,但这是非常危险的,我不推荐它。