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?

谢谢

4

1 回答 1

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

您也可以/usr/bin/python使用指向 Python 3.3 的链接进行覆盖,但这非常危险,我不推荐这样做。

于 2013-10-18T05:16:35.730 回答