Ubuntu16.04版本最新的Python 3.x版本3.5 。@H_404_1@
要安装Python 3.6 ,请运行以下命令:@H_404_1@
# wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
# tar -xvf Python-3.6.2.tar.xz
# cd Python-3.6.2
# ./configure
# make
# make install
如果出现错误:
can’t decompress data; zlib not available
说明缺少依赖:zlib。@H_404_1@
# 安装依赖zlib、zlib-devel
# 在ubuntu里,zlib叫zlib1g,相应的zlib-devel叫zlib1g-dev
$ sudo apt-get install zlib1g
$ sudo apt-get install zlib1g-dev
当安装完成后,使用它来验证主二进制文件的位置:@H_404_1@
# which python3
# python3 -V
如果不是最新的3.6,重启系统。@H_404_1@
在Linux中检查Python 3版本@H_404_1@
# python3
quit()
or
exit()
并按Enter键。@H_404_1@
恭喜!Python 3.6现在安装在您的系统上。@H_404_1@
执行pip install时出现:
pip is configured with locations that require TLS/SSL,however the ssl module in Python is not available.
@H_404_1@
需要安装:@H_404_1@
$ sudo apt-get install openssl
$ sudo apt-get install libssl-dev
重新@H_404_1@
$ sudo ./configure
$ sudo make && make install
原文链接:https://www.f2er.com/ubuntu/352040.html