环境信息:
操作系统:ubuntu 16.04
安装软件:python3.7 setuptools pip
关闭防火墙:UFW禁用
软件下载地址:
python3.7下载地址:https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
pip下载地址:https://files.pythonhosted.org/packages/45/ae/8a0ad77defb7cc903f09e551d88b443304a9bd6e6f124e75c0fbbf6de8f7/pip-18.1.tar.gz
setuptools下载地址:https://files.pythonhosted.org/packages/37/1b/b25507861991beeade31473868463dad0e58b1978c209de27384ae541b0b/setuptools-40.6.3.zip
#以上地址都可通过的wget的的的的的直接下载
操作步骤:
一,更换易于得到的源
#备份旧的源
mv /etc/apt/sources.list / tmp
vim sources.list
deb-src http://archive.ubuntu.com/ubuntu xenial main受限于软件属性#Added
deb http://mirrors.aliyun.com/ubuntu/ xenial主要限制
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial- updates主要限制
deb-src http://mirrors.aliyun.com/ubuntu/xenial- updates主要限制多元宇宙#由软件属性添加
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-更新宇宙
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-更新多元宇宙
deb http://mirrors.aliyun.com/ubuntu/xenial-backports主要限制宇宙多元宇宙
deb-src http://mirrors.aliyun.com/ubuntu/xenial-backports主要受限制的宇宙multiverse #Added由software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security主要限制
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
二,更新易于得到的源
apt-get update
三,安装依赖包
apt-get install wget vim gcc make libffi-dev openssl openssl-devel libbz2-dev -y
四,安装python3.7
tar xf Python-3.7.0.tgz
cd Python-3.7.0
./configure --prefix = / opt / python3.6.5 --with-ssl
make
make install
#软连接,可以直接执行python3.7命令
ln -s /opt/python3.7/bin/python3.7 /usr/bin/python3.7
五,安装setuptools
解压setuptools-40.6.3.zip
cd setuptools-40.6.3 /
python3.7 setup.py build
python3.7 setup.py install
六,安装PIP
tar xf pip-18.1.tar.gz
cd pip-18.1 /
python3.7 setup.py build
python3.7 setup.py install
七,验证Python3.7
1, python3.7 -V或直接执行python3.7
成功
2,验证PIP
cd /opt/python3.7/bin/
./pip3.7 -V
3、软连接
ln -s /opt/python3.6.5/bin/pip3.6 /usr/bin/pip3.6
八,清理垃圾数据
rm -rf pip-18.1.tar.gz
rm -rf setuptools-40.6.3.zip
rm -rf Python-3.7.0.tgz
敲完收工!