环境:Centos6.5
1. 安装依赖。
[root@localhost ~]# yum -y install openssl-devel gcc libffi-devel
2. 解压安装。
[root@localhost ~]# tar xf Python-3.5.0.tgz [root@localhost ~]# cd Python-3.5.0/ [root@localhost ~]# ./configure --prefix=/usr/local/python3.5 [root@localhost ~]# make -j 4 && make install # 4为CPU核数
3. 设置环境变量
[root@localhost ~]# echo "export PATH=/usr/local/python3.5/bin:\$PATH" > /etc/profile.d/python3.5.sh [root@localhost ~]# . /etc/profile.d/python3.5.sh
4. 安装ipython
[root@localhost ~]# tar xf ipython-5.0.0.tar.gz [root@localhost ~]# cd ipython-5.0.0/ [root@localhost ~]# python3.5 setup.py install [root@localhost ~]# pip3.5 install traitlet [root@localhost ~]# pip3.5 install pygments [root@localhost ~]# pip3.5 install pexpect [root@localhost ~]# pip3.5 install pickleshare [root@localhost ~]# pip3.5 install prompt_toolkit [root@localhost ~]# pip3.5 install simplegeneric
常见报错:
1. No module named '_ctypes'
原因:没有安装libffi-devel包
2. python安装后没有安装pip
原因:编译前没有安装openssl-devel包