一、下载
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
二、解压
tar -zxvf Python-3.6.4.tgz
三、编译和安装
进入解压后的Python-3.6.4的文件夹,编译和安装Python 3.6.4
cd Python-3.6.4
./configure --prefix=/usr/local/python3.6
make &&make install
四、配置到环境变量中,添加如下:
vi /etc/profile
#python3.6 export PATH=/usr/local/python3.6/bin:$PATH
让配置文件立即生效
source /etc/profile
输入python3看看是否安装成功
安装pip以及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
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
3.验证
最后输入pip3