我正在尝试将我的Python从版本2.7.3更新到版本3.3.3我已经使用Mac OS X 64位/ 32位安装程序(3.3.3)从download page安装了它适用于Mac OS X 10.6及更高版本。我已成功安装它,我的应用程序中有一个Python 3.3文件夹,一切似乎都没问题。唯一的问题是,当我输入
时python
进入终端,它仍然说
Last login: Wed Nov 27 12:20:07 on ttys000
Computer:~ user$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
我执行了“更新Shell Profile Profile.com”可能50次,并显示
Last login: Wed Nov 27 12:19:44 on ttys000
Julian:~ julianmontague$ /Applications/Python\ 3.3/Update\ Shell\ Profile.command ; exit;
This script will update your shell profile when the 'bin' directory
of python is not early enough of the PATH of your shell.
changes will be effective only in shell windows that you open
after running this script.
All right, you're a python lover already
logout
[Process completed]
我不记得它显示的是什么,但它显示了类似的东西,而不是“好吧,你已经是一个蟒蛇爱好者了”。
我从我的Applications文件夹中删除了Python 2.7文件夹,我从usr / local / bin /删除了一些其中有2.7的东西,我已经重新启动了我的计算机,但它仍然说我有2.7。 3。
答案 0 :(得分:3)
你需要在终端中使python 3.3成为默认的python版本。
你需要把python带到正确的地方:sudo rm -R /System/Library/Frameworks/Python.framework/Versions/3.3
sudo mv /Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions
然后您需要修复该组并更新链接:
sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/3.3
sudo rm /System/Library/Frameworks/Python.framework/Versions/Current
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions/Current
然后你需要修复/usr/bin/
因为pythonw等没有链接但是通过删除旧副本驻留在/usr/bin
中:
sudo rm /usr/bin/pydoc
sudo rm /usr/bin/python
sudo rm /usr/bin/pythonw
sudo rm /usr/bin/python-config
然后您需要通过以下方式修复CURRENT版本链接:
sudo rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc
sudo rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python
sudo rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw
sudo rm /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python-config
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc3 /usr/bin/pydoc
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3 /usr/bin/python
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3 /usr/bin/pythonw
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3-config /usr/bin/python-config