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


当前回答

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

转到3.7.3版本

其他回答

适用于osx brew用户

我的问题似乎与我的python安装有关,并通过重新安装python3和pip迅速解决。我认为它在操作系统更新后开始出错,但谁知道呢(此时我使用的是Mac OS 10.14.6)

brew reinstall python3 --force
# setup pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
# installa pkg successfully 
pip install pandas

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

转到3.7.3版本

如果你在Windows上使用Anaconda,你可以尝试在Anaconda提示符中运行“pip install…”命令,而不是cmd.exe,就像用户willliu1995在这里建议的那样。这对我来说是最快的解决方案,不需要安装额外的组件。

我在OSX 10.11上遇到了类似的问题,因为在3.6之上安装了python 3.7的memcached。

警告:pip配置了需要TLS/SSL的位置,但是Python中的SSL模块不可用。

花了几个小时解链接openssl,重新安装,改变路径。但一切都无济于事。将openssl版本从旧版本更改为旧版本,做到了这一点:

brew switch openssl 1.0.2e

我在网上没有看到这个建议。希望它能为某人服务。

我做了一些PATH更改,以模仿Anaconda Powershell提示$env:PATH的一部分

C:\Users\merheb\Miniconda3;C:\Users\merheb\Miniconda3\Library\mingw-w64\bin;C:\Users\merheb\Miniconda3\Library\usr\bin;C:\Users\merheb\Miniconda3\Library\bin;C:\Users\merheb\Miniconda3\Scripts;C:\Users\merheb\Miniconda3\bin;C:\Users\merheb\Miniconda3\condabin;

这招对我很管用。