我已经在我的本地机器上成功安装了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。pip install <package>?


当前回答

在使用pyenv来管理Mac OS Catalina上的python安装的情况下,我必须先用brew安装openssl,然后运行pyenv install 3.7.8,这似乎是使用homebrew中的openssl来构建python安装(它甚至在安装输出中这样说)。然后pyenv global 3.7.8,我离开了。

其他回答

在使用pyenv来管理Mac OS Catalina上的python安装的情况下,我必须先用brew安装openssl,然后运行pyenv install 3.7.8,这似乎是使用homebrew中的openssl来构建python安装(它甚至在安装输出中这样说)。然后pyenv global 3.7.8,我离开了。

I finally solve this issue. These are the detail of my env: Version of Python to install: 3.6.8 OS: Ubuntu 16.04.6 LTS Root access: No Some people suggest to install libssl-dev, but it did not work for me. I follow this link and I fixed it! In short, I download, extract, build, and install OpenSSL (openssl-1.1.1b.tar.gz). Then, I modify .bashrc file follow this link. Next, I download and extract Python-3.6.8.tgz. I edit Modules/Setup.dist to modify SSL path (lines around #211). I did ./configure --prefix=$HOME/opt/python-3.6.8, make and make install. Last, I modify my .bashrc. Notice that I do not include --enable-optimizations in ./configure.

前两天我也遇到了同样的问题,直到现在才解决。

我尝试使用digicert_high_asance_ev_root_ca的——trust-host选项。pem不工作,我无法安装ssl模块(它告诉它不能安装python版本大于2.6),设置$PIP_CERT变量也没有修复它,我安装了libssl1.0.2和libssl1.0.0。值得一提的是,我没有~/.pip/pip.conf文件,创建它也没有解决这个错误。

最终解决这个问题的方法是再次使用make安装python3.6。 下载Python-3.6.0。从网站TGZ,运行配置,然后使,使测试,使安装。希望这对你有用。

我可以通过更新这个文件中的python版本来修复这个问题。 pyenv: version ' 3.6.5'未安装(由/Users/taruntarun/.python-version设置) 虽然我安装了最新版本,但我的命令仍然使用旧版本3.6.5

转到3.7.3版本

这个问题可能是库丢失造成的。

在安装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

更多信息请参见如何在Ubuntu和LinuxMint上安装Python 3.6.0