我已经在本地机器上成功安装了Python 3.4和Python 3.6,但无法安装pip3
的软件包。
当我执行pip3 install <package>
时,我得到以下SSL相关的错误。
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting <package>
Could not fetch URL https://pypi.python.org/simple/<package>/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement <package> (from versions: )
No matching distribution found for <package>
我怎样才能修复我的Python3.x安装,使我能够用pip install <package>
来安装软件包?
在Ubuntu中安装Python 3.6和pip3的步骤指南。
1.安装Python和ssl的必要软件包: $ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
。
2.从https://www.python.org/ftp/python/ 下载并解压"Python-3.6.8.tar.xz" 到你的主目录。
3.在该目录下打开终端并运行。$ ./configure
。
4.建立并安装。$ sudo make && sudo make install
。
5.用以下方法安装软件包。$ pip3 install package_name
。
这个问题可能是由库丢失引起的。
在安装Python 3.6之前,请确保安装所有Python需要的库。
$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
我在过去的两天里也有同样的问题,现在才修好。
我曾尝试使用--trust-host
选项和DigiCert_High_Assurance_EV_Root_CA.pem
不起作用,我无法安装ssl模块(它告诉我python版本大于2.6时无法安装),设置$PIP_CERT
变量也没有解决,我安装了libssl1.0.2
和libssl1.0.0
。另外值得一提的是,我没有~/.pip/pip.conf
文件,创建它也没有解决这个问题。
最后解决这个问题的方法是用make
重新安装Python3.6。
从网站上下载Python-3.6.0.tgz,运行configure
然后make
,make test
和make install
。希望它对你有用。