在linux下升级python版本

升级python版本

查看python版本:


$ python -V
Python 2.6.6

升级版本到2.7:


$ Python 2.7.6:
$ wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
$ tar xf Python-2.7.6.tar.xz
$ cd Python-2.7.6
$ ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
$ make && make altinstall

建立软连接,使系统默认的 python指向 python2.7

$ mv /usr/bin/python /usr/bin/python2.6.6 
$ ln -s /usr/local/bin/python2.7 /usr/bin/python 

再次查看python版本:


$ python -V
Python 2.7.6

你可能感兴趣的:(linux学习笔记,linux,python)