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]