Upgrade python in linux version

Upgrade python in linux version

Download python compile and install the latest version 2.7.13

<pre>
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.13.tar.xz
xz -d Python-2.7.13.tar.xz
tar xf Python-2.7.13.tar
cd Python-2.7.13
./configure --prefix=/usr/local/python-2.7.13
make
make install
</pre>


Python-2.7.13 will be installed in the directory /usr/local/python-2.7.13

The system comes with Python under / usr / bin directory


<pre>
ll -tr /usr/bin/python*

/usr/bin/python2.6-config
/usr/bin/python2.6
/usr/bin/python
/usr/bin/python2 -> python
/usr/bin/python-config -> python2.6-config
</pre>


Update the default version of Python
to back up the old python

<pre>

mv /usr/bin/python /usr/bin/python2.6.6
mv /usr/bin/python-config /usr/bin/python2.6-config

ln -s /usr/local/python-2.7.13/bin/python2.7 /usr/bin/python
ln -s /usr/local/python-2.7.13/bin/python-config /usr/bin/python-config
ln -s /usr/local/python-2.7.13/bin/python2.7 /usr/bin/python2.7
</pre>


Check out the new version of Python

<pre>
python --version
Python 2.7.13
</pre>

Guess you like

Origin www.cnblogs.com/newmiracle/p/11856324.html