Linux之CentOS编译安装指定版本Python和安装iPython

[root@Legion10 ~]# wget -c http://www.dwhd.org/script/tar_gz_bz2/Python-2.7.10.tar.xz
[root@Legion10 ~]# wget -c http://www.dwhd.org/script/tar_gz_bz2/ipython-3.0.0.tar.gz
[root@Legion10 ~]# yum install readline-devel sqlite-devel -y
#这里如果不安装readline-devel,后面编译的python将没有删除功能
#这里如果不安装sqlite-devel,后面的iPython将报错(WARNING: IPython History requires SQLite, your history will not be saved)
[root@Legion10 ~]# tar xf Python-2.7.10.tar.xz
[root@Legion10 ~]# tar xf ipython-3.0.0.tar.gz
[root@Legion10 ~]# cd Python-2.7.10/
[root@Legion10 ~/Python-2.7.10]# ./configure --prefix=/usr/local/python2.7.10
[root@Legion10 ~/Python-2.7.10]# make -j $(awk '/processor/{i++}END{print i}' /proc/cpuinfo) && make install
[root@Legion10 ~/Python-2.7.10]# cd ../ipython-3.0.0/
[root@Legion10 ~/ipython-3.0.0]# /usr/local/python2.7.10/bin/python2.7 setup.py build
[root@Legion10 ~/ipython-3.0.0]# /usr/local/python2.7.10/bin/python2.7 setup.py install
[root@Legion10 ~/ipython-3.0.0]# cd ..
[root@Legion10 ~]# ln -sv /usr/local/python2.7.10/bin/ipython /usr/bin/
"/usr/bin/ipython" -> "/usr/local/python2.7.10/bin/ipython"
[root@Legion10 ~]# ln -sv /usr/local/python2.7.10/bin/python2.7 /usr/bin/
"/usr/bin/python2.7" -> "/usr/local/python2.7.10/bin/python2.7"
[root@Legion10 ~]# ipython -c "print 'hello'"
hello
[root@Legion10 ~]# ipython
Python 2.7.10 (default, Aug 27 2015, 01:19:59) 
Type "copyright", "credits" or "license" for more information.

IPython 3.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import platform

In [2]: platform.uname()
Out[2]: 
('Linux',
 'Legion10.dwhd.org',
 '2.6.32-573.3.1.el6.centos.plus.x86_64',
 '#1 SMP Fri Aug 14 01:00:05 UTC 2015',
 'x86_64',
 'x86_64')

In [3]: platform.
platform.DEV_NULL               platform.node                   platform.python_implementation  platform.system
platform.architecture           platform.os                     platform.python_revision        platform.system_alias
platform.dist                   platform.platform               platform.python_version         platform.uname
platform.java_ver               platform.popen                  platform.python_version_tuple   platform.version
platform.libc_ver               platform.processor              platform.re                     platform.win32_ver
platform.linux_distribution     platform.python_branch          platform.release                
platform.mac_ver                platform.python_build           platform.string                 
platform.machine                platform.python_compiler        platform.sys                    

In [3]: exit
[root@Legion10 ~]#

你可能感兴趣的:(linux)