python3和python2虽然语法有很大区别,但python2和python3源码安装是一样的, 这里以python3安装为例:
======================python3安装==================================
yum install -y openssl openssl-devel gdbm gdbm-devel gcc gcc-c++ bzip2 bzip2-devel lzma xz-devel
yum install -y xz-compat-libs ncurses ncurses-devel sqlite sqlite-devel readline readline-devel tk tk-devel
[[email protected] ~]# tar -xzvf Python-3.5.2.tar.gz
[[email protected] ~]# cd Python-3.5.2
[[email protected] Python-3.5.2]# ./configure --prefix=/usr/local/Python35
[[email protected] Python-3.5.2]# make
[[email protected] Python-3.5.2]# make install
[[email protected] Python-3.5.2]# ln -sv /usr/local/python35/bin/python3.5 /usr/bin/python35
[[email protected] Python-3.5.2]# python35
>>>
=====================Ipython安装====================================================
Ipython安装,ipython 可以补全
[[email protected] ~]# tar -xzvf ipython-5.1.0.tar.gz
[[email protected] ~]# cd ipython-5.1.0
[[email protected] ipython-5.1.0]# /usr/local/python35/bin/python3.5 setup.py build
[[email protected] ipython-5.1.0]# /usr/local/python35/bin/python3.5 setup.py install
[[email protected] ipython-5.1.0]# /usr/local/python35/bin/python3.5 setupegg.py build
[[email protected] ipython-5.1.0]# /usr/local/python35/bin/python3.5 setupegg.py install
[[email protected] ipython-5.1.0]# ln -sv /usr/local/python35/bin/ipython3 /usr/bin/
[[email protected] ipython-5.1.0]# ipython3
Python 3.5.2 (default, Sep 11 2016, 19:43:24) Type "copyright", "credits" or "license"
for more information. IPython 5.1.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]:
=========================安装完毕=================================================