Python2.7 upgrade Python3.3 steps for Mac OS X10.9 installation _python

Source: Internet
Author: User
Tags in python

1th Step: Website Download Python3.3

Here are the Windows and Mac OS X installer, download the 64-bit installer

2nd step: Install the downloaded img file, after the installation of the following directory:

Copy Code code as follows:

/library/frameworks/python.framework/versions/3.3

Step 3rd: Move the Python installation directory

The original installation directory is shown in step 2nd, but all Python is
/system/library/frameworks/python.framework/versions
directory, so it is best to use the following command to move, of course not to move also can. However, some of the paths in the following steps need to be modified.
sudo mv/library/frameworks/python.framework/versions/3.3/system/library/frameworks/python.framework/versions
Step 4th: Change the user group for the Python installation directory to wheel

Copy Code code as follows:

sudo chown-r root:wheel/system/library/frameworks/python.framework/versions/3.3

python2.7 's user group is wheel,3.3 also divert!

Step 4th: Modify the symbolic link for the current installation directory in Python

There is a current in the/system/library/frameworks/python.framework/versions/directory, which is a table of contents symbolic link that points to the present Python version. The original point to 2.7, now points to 3.3. So you should delete current first. Then re-establish the current symbolic link with the following command:

Copy Code code as follows:

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

Step 5th: Delete the old command symbol link

There are 4 symbolic links to the Python commands in the/usr/bin directory, using the following command to delete the

Copy Code code as follows:

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

Step 6th: Re-establish a new command symbol link

Use the following command to set up the symbolic links removed in step 6th, all pointing to Python3.3.

Copy Code code as follows:

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

Step 7th: Update the path in the/root/.bash_profile file

Copy Code code as follows:

CD ~
Vim. Bash_profile

Insert the following content in the. bash_profile

Copy Code code as follows:

# 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 reboot the console, then execute the Python--version and get the Python 3.3.3. If you need to use the following code to get the Python version in your program

Copy Code code as follows:

Import Platform
Print (Platform.python_version ())

If you still use the IDE, such as Pydev, you still need to update the associated path.

The

is now ready to use the latest Python3.3.3.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.