Python依赖包
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
下载Python安装包
wget --no-check-certificate https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
解压到当前目录
tar -zxvf Python-3.5.0.tgz
cd Python-3.5.0
./configure --prefix=/usr/local/python3.5 --enable-shared
make & make install
ln -s /usr/local/python3.5/bin/python3 /usr/bin/python3
如果报错缺少.so文件,我们需要进行如下操作
cp -R /usr/local/python3.5/lib/* /usr/lib64/
安装pip以及setuptools
pip 是下载Python第三方库的命令,安装之前,首先安装setuptools
1.安装setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
tar -zxvf setuptools-19.6.tar.gz
cd setuptools-19.6
python3 setup.py build
python3 setup.py install
报错:RuntimeError: Compression requires the (missing) zlib module
需要安装zlib-devel包
yum install zilb-devel
需要对python3.5进行重新编译安装。
cd python3.5
make & make install
又是漫长的编译安装过程。
重新安装setuptools
python3 setup.py build
python3 setup.py install
2、安装pip
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
tar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python3 setup.py build
python3 setup.py install
如果没有意外的话,pip安装完成。