【问题标题】:SSL module not available when installing python modules安装 python 模块时 SSL 模块不可用
【发布时间】:2019-04-14 09:03:36
【问题描述】:
我一直在尝试从 cmd 安装 python 模块,
但我收到以下错误:
确认 ssl 证书时出现问题:
HTTPSConnectionPool(host='pypi.org', port=443): url: /simple/pip/ 超过最大重试次数(由 SSLError("Can't connect to HTTPS URL because the SSL module is not available. "))
如果有人可以提供帮助,那就太好了!
错误图片:
【问题讨论】:
标签:
python
installation
ss
【解决方案1】:
我在 macOS 上遇到了同样的问题。我想我的问题是因为我的 python@2 是由 homebrew 安装的。
搜索并尝试了很多方法。这对我有用,如果您也碰巧在 macOS 上使用自制软件,供您参考。
我。在 macOS 上使用默认 python
步骤 1。 brew卸载python@2
步骤 2。 sudo /usr/bin/easy_install pip
第 3 步。 cdHOMBREW_BIN_PATH
第四步。 ln -sf /usr/bin/python python
第五步。 ln -sf /usr/local/bin/pip pip
那么你就可以像往常一样使用 pip 了。
二。使用非 https 源的解决方法
参考:https://blog.51cto.com/tenderrain/1956752
假设这里我们使用mirrors.aliyun.com的非https源,并且想安装six
方法1。直接通过 CLI
pip install -i http://mirrors.aliyun.com/pypi/simple六 --trusted-host mirrors.aliyun.com
方法2。创建一个 ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
然后照常使用pip install six。