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


当前回答

如果你在OSX上,万一其他解决方案不适合你(就像我一样)。

您可以尝试卸载python3并升级pip3

brew uninstall --ignore-dependencies python3
pip3 install --upgrade pip   

这对我很有用;)

其他回答

如果你在OSX上,万一其他解决方案不适合你(就像我一样)。

您可以尝试卸载python3并升级pip3

brew uninstall --ignore-dependencies python3
pip3 install --upgrade pip   

这对我很有用;)

我尝试了很多方法来解决这个问题,但没有一个解决。我现在用的是Windows 10。

唯一有效的方法是:

卸载蟒蛇 卸载Python(我使用的是3.7.3版本) 再次安装Python(记得勾选自动添加到PATH的选项)

然后我用PIP下载了我需要的所有lib…和工作!

不知道为什么,或者这个问题是否与水蟒有关。

我在ubuntu14.04机器上安装python3.7时遇到了同样的问题。 问题是我的PKG_CONFIG_PATH和LD_LIBRARY_PATH中有一些自定义文件夹,这阻止了python构建过程找到系统openssl库。

所以试着清除它们,看看会发生什么:

export PKG_CONFIG_PATH=""
export LD_LIBRARY_PATH=""

在Ubuntu中,这可以帮助:

cd Python-3.6.2
./configure --with-ssl
make
sudo make install

python文档实际上非常清楚,按照说明做了工作,而我在这里找到的其他答案并没有解决这个问题。

首先,安装python 3.x。例如3.6.2版本https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz 通过运行brew install openssl,确保已经安装了openssl tar xvzf python -3.6.2.tar。xz && cd Python-3.6.2 然后如果python版本< 3.7,则运行

CPPFLAGS="-I$(brew -prefix openssl)/include" \ LDFLAGS="-L$(brew -prefix openssl)/lib" \ . / configure——with-pydebug 5. 最后,运行make -s -j2 (-s是沉默标志,-j2告诉您的机器使用2个作业)