Install multiple versions under Python Linux

Source: Internet
Author: User
Tags install django

Linux Ubuntu 12.04 has its own Python2.7.3 version, and if you need to install a different version of the general operation is:

It's best to check for dependencies first

sudo apt-get build-dep python

(If you subsequently install Django, remember to install the Libssl-dev library and then install Python and setuptools, you can install Django with Easy_install)

Installation of a new version
1. Download the new source code, python.org;
2. Decompression, into the unpacked folder, the implementation
./configure--prefix=/usr/local/python-2.7.10
(Here is the path to set up the installation, the following operations have an impact, the general default this bar);
3. Compile (make, sudo make install) (Note If higher permissions are required in the/usr/directory);

Second, check the original version
With Python and python2.7 two files in the yourname@ubuntu:/usr/bin/directory, we can use the following two commands:

Yourname@ubuntu:/usr/bin$./python
yourname@ubuntu:/usr/bin$./python2.7

See how much of the Python version corresponds to each of them,
found that both correspond to version 2.7.3.

Third, version modification
Suppose our newly installed version is 2.7.10,
If we need to perform the 2.7.10 version instead of the 2.7.3 version by default, the $python is implemented by modifying the soft link of the original/usr/bin/python.

$sudo ln-s-f/usr/local/python-2.7.10/bin/python/usr/bin/python
You can view the specific file name of the newly installed Python version under/usr/local/, for example, this is python-2.7.10, which is actually the first step when we install the-s to create a soft connection-f enforcement, if the original/usr/bin/ Python already exists under

This executes the command again:

$ python
[hint 2.7.10]

$ python2.7
[hint 2.7.3 version, since there are no changes to the/usr/bin/python2.7 link, but also to retain the original version]
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.