WD40
WD40

Reputation: 458

Python doesn't update correctly

I am trying to update my Python from version 2.7.3 to version 3.3.3 I have installed it from the download page, using the Mac OS X 64-bit/32-bit Installer (3.3.3) for Mac OS X 10.6 and later. I have successfully installed it, there is a folder Python 3.3 in my Applications, and everything seems to be fine. The only problem is, when I type

python

into terminal, it still says

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.
>>> 

I have executed the "Update Shell Profile Profile.command" maybe 50 times, and it displays

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]

I can't remember exactly what it displayed, but it displayed something similar, with something else instead of "All right, you're a python lover already".

I have deleted the Python 2.7 folder from my Applications folder, I've deleted a few things that had 2.7 in them from usr/local/bin/, I have restarted my computer, but it still says that I have 2.7.3.

Upvotes: 3

Views: 5468

Answers (1)

iseng
iseng

Reputation: 31

you need to make python 3.3 the default python version in terminal.

fist you need to python into the right place:

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

then you need to fix the group and update the link:

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

then you need to fix /usr/bin/ since pythonw etc are not linked but reside in /usr/bin by removing the old copies:

sudo rm /usr/bin/pydoc
sudo rm /usr/bin/python
sudo rm /usr/bin/pythonw
sudo rm /usr/bin/python-config

and then you need to fix the CURRENT version link by:

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

Upvotes: 3

Related Questions