[英]How to change python version (interactive mode) in macports?
[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?
謝謝
當您鍵入python
時獲得的解釋器包含在OS X中,這意味着為OS X編寫的程序將期望python
為2.7。 更改它很危險,因為它可能會破壞程序,這可能就是macports不會搞砸它的原因。
如果確實需要,可以通過將Macports的bin
目錄放在/usr/bin
之前的PATH
:
export PATH=/path/to/macports/bin:$PATH
您應該能夠找到which python33
的正確路徑。
您也可以使用指向Python 3.3的鏈接覆蓋/usr/bin/python
,但這非常危險,我不建議這樣做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.