Ubuntu16下安装python3.6

1.下载python3.6的包

在终端中输入下面的命令


  1. wget http://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz  
  2. tar -xvzf Python-3.6.4.tgz  
  3. cd Python-3.6.4  
  4. ./configure --prefix=/opt/python3.6  #指定安装目录
  5. ./configure --with-ssl                   #指定用ssl功能,要不然pip安装功能不好用
  6. make  
  7. sudo make install  

装好后,将 /opt/python3.6/bin 加入 PATH,如下,

    

export PATH=/opt/python3.6/bin:$PATH


如果要安装对应于 Python3.6 的软件包,则要使用 pip3.6,添加如下语句到 .bashrc,

    

alias "pip3.6"="python3.6 -m pip $1"

4,可能在安装过程中会出现下面错误

zipimport.ZipImportError: can't decompress data; zlib not available

解决办法

apt-get install zlib*

5,如下出现如下错误,有可能缺少和ssl相关的包

pip is configured with locations that require TLS/SSL, however the ssl modul

解决:apt-get install libssl-dev

https://stackoverflow.com/questions/41489439/pip3-installs-inside-virtual-environment-with-python3-6-failing-due-to-ssl-modul

参考博客:

https://www.cnblogs.com/gaowengang/p/7736672.html

https://blog.csdn.net/qq_37659064/article/details/79329156

https://blog.csdn.net/jeryjeryjery/article/details/77880227

https://www.cnblogs.com/zhangym/p/6226435.html

你可能感兴趣的:(Ubuntu16下安装python3.6)