How to upgrade the Mac OS X10.9 Python2.7 to the new Python3.3

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

The default Mac OS X10.9 with Python2.7, but now Python3.3.3 out, if you want to use the latest version, quickly upgrade. The basic steps are as follows.


The first step: Download Python3.3

Download the address is as follows:

Python3.3

There is a setup program windows and Mac OS X, download and install the program that 64 bit (estimates now no use 32 bit Mac OS X.)


The second step:

Install the downloaded img file, after the installation directory.:


/Library/Frameworks/Python.framework/Versions/3.3

The third step: the installation directory in mobile Python

The original installation directory to see the second step, but all of the python in
/System/Library/Frameworks/Python.framework/Versions
Directory, so it is best to use the following command to move, of course not the mobile can. But some path back steps need to modify the.
sudo mv /Library/Frameworks/Python.framework/Versions/3.3 /System/Library/Frameworks/Python.framework/Versions


The fourth step: to change the Python installation directory for the wheel user group


sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/3.3

The python2.7 user group is wheel, 3.3 copy.!


The fifth step: modify the symbolic link current Python installation directory

There is a Current in the /System/Library/Frameworks/Python.framework/Versions/ directory, this is a directory of symbolic links, pointing to the current version of Python. The original point to 2.7 points to 3.3, now. So you should delete the Current. Then the re establishment of Current symbolic links, the following command:


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

The sixth step: delete the symbolic link the old command

A symbolic link 4 Python commands in the /usr/bin directory, use the following command to delete
sudo rm /usr/bin/pydoc
sudo rm /usr/bin/python
sudo rm /usr/bin/pythonw
sudo rm /usr/bin/python-config

The seventh step: the re establishment of the new order of symbolic links
The sixth step to delete the symbolic link to use the following command set, they point to the Python3.3. 

sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pydoc3.3 /usr/bin/pydoc
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 /usr/bin/python
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/pythonw3.3 /usr/bin/pythonw
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3m-config /usr/bin/python-config

The eighth step: the path to update the /root/.bash_profile file.
cd ~

vim .bash_profile 

Insert the following content can be in.Bash_profile

# Setting PATH for Python 3.3
# The orginal version is saved in .bash_profile.pysave
PATH="/System/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}"
export PATH

ok, Now restart Console, and then executes the python --version, the 3.3.3 is Python. If in the program, use the following code to obtain the python version

import platform
print(platform.python_version())

If still used such as PyDev IDE, still need to update the related path.

You can now use the new Python3.3.3.





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Mike at December 12, 2013 - 2:44 AM