The Python version on the server is so old that I need to install a new version of Python to run my code. Because the environment needs it, but you can’t uninstall the old version, install a new one and use the soft chain to upgrade.
Use the system’s own yum, apt-get and other software that is definitely not able to install, need to re-source compilation install.
Download Python source code
The source file to download from http://www.python.org/download/.
If this URL is a wall, can try to solve multiple diagonal lines, such as http://www.python.org////////////download///////////////.
Find one of the download link to download such as http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
Compile the installation
The tar ZXVF Python – 2.7.6. TGZ
CD Python – 2.7.6
/configure –prefix=/usr/local/python-2.7.6
make
sudo make install
Modify the Python soft chain
The default Python command is in the /usr/bin/directory, where you need to change the soft chain to version 2.7 and create a soft chain of 2.4.
Mv /usr/bin/python /usr/bin/python2.4
Ln -s/usr/local/python – 2.7.6 / bin/python/usr/bin/python
How to install pip for python 2.6?
PIP is not available in older versions of Python, so you need to install it yourself manually. It’s as simple as downloading a file.
To install PIP, securely download get-pip.py.
Reference: https://pip.pypa.io/en/stable/installing/
The original link: http://www.chenyudong.com/archives/mutiple-python-install-on-linux.html
Additional links: under Linux config/configure/configure, make, make test/make check, sudo make install