My machine's default Python version is 2.6.6, and now I want to install a 2.7 version.
Download address of package: https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
Ensure that it is installed first: zlib zlib-devel OpenSSL openssl-devel readline readline-devel
First, the specific installation:
Tar zxf python-2.7.10.tgz
CD Python-2.7.10
./configure--prefix=/usr/local/python
Make && make install
Second, start python2.7:
[Root@pc ~]#/usr/local/python/bin/python2.7
Third: Establish soft connection
Ln-s/usr/local/python/bin/python2.7/bin/python2.7
[Root@pc download]# python2.7
Python 2.7.10 (Default, Dec 31 2015, 02:13:11)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
Four: Set python2.7 as the default version
[Root@pc bin]# mv/usr/bin/python/usr/bin/python2.6.6
[Root@pc bin]# ln-s/usr/local/python/bin/python2.7/usr/bin/python
[Root@pc bin]# python
Python 2.7.10 (Default, Dec 31 2015, 02:13:11)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>>
--This article from: http://www.linuxidc.com/Linux/2015-08/120895.htm,
Http://www.linuxeye.com/Linux/1762.html,
Http://blog.sina.com.cn/s/blog_69309a3c0100wit5.html