环境:red hat 4.7
一.python3.5 安装
# 下载
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tar.xz
# 解压
tar xvf Python-3.5.0.tar.xz
cd Python-3.5.0
# 指定路径安装
./configure --prefix=/usr/local/python3
make
make install
# 建立软连接
#不要覆盖原来版本的链接,所以最好起名python3
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
# 测试
python
二.安装pip
# 首先安装setuptools
yum install zlib-devel
# 从新编译python3
cd /usr/local/python3
make
make install
#下载安装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
# 安装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
如果报错。可能是缺少环境
yum install openssl-devel #完成后从新编译python3
# 建立软连接
ln -s /usr/local/python3/bin/pip /usr/bin/pip
# 测试
pip