1、输入命令wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0b2.tgz
,下载python文件
2、解压缩 tar -zxvf Python-3.7.0b2.tgz
3、cd Python-3.7.0b2
进入文件夹
4、./configure --prefix=/usr/local --with-ssl
5、make && make install
6、输入python3 -V
查看版本信息
7、修改python3的软链接(之前有装过python3.5):
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 2
update-alternatives --config python3
8、python3自带venv,创建:python3 -m venv test
;激活:source test/bin/activate
;关闭:deactivate
(创建虚拟环境时出现“Error: Command ‘[‘/home/py3/py3.5/test/bin/python3’, ‘-Im’, ‘ensurepip’, ‘–upgrade’, ‘–default-pip’]’ returned non-zero exit status 2.”错误,使用命令:python3 -m venv --without-pip test
)
大神