【问题标题】:Errors while trying to install pip from terminal尝试从终端安装 pip 时出错
【发布时间】:2018-06-18 14:22:50
【问题描述】:

我正在尝试通过 bash 脚本/终端安装 pip3。我正在使用以下命令:

curl -O https://bootstrap.pypa.io/get-pip.py
/usr/local/bin/python3.6 get-pip.py

当我运行这两个命令时,我得到了一些我不理解的奇怪错误。有人可以解释这些错误的含义以及如何修复它们(或者让我知道是否有比 brew 更好的安装 pip3 的方法)?

Operating system: Mac OSX
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1603k  100 1603k    0     0  8216k      0 --:--:-- --:--:-- --:--:-- 8224k
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pip
  Cache entry deserialization failed, entry ignored
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
  Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
  Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Cache entry deserialization failed, entry ignored
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping

【问题讨论】:

  • 我认为您需要根据这一行在python中安装SSL模块:''pip配置了需要TLS / SSL的位置,但是Python中的ssl模块不可用。''跨度>
  • 是的,但我不需要 pip 来安装模块吗?
  • 我应该只使用easy_install 来获得我想要的pip 的适当版本吗?然后去那里用pip 安装东西?
  • 我觉得你需要安装openssl这样的系统模块,我不知道在MacOS上怎么做
  • 我认为是第一个命令产生的错误,在https中不带s试试

标签: python-3.x bash pip


【解决方案1】:

此错误消息的原因是您的系统缺少 SSL 模块,您无法对HTTPS URL 执行任何请求,请尝试不使用“s”http 而不是 https

或最好的,安装 OpenSSL 可能使用 brew install openssl 查看官方文档以获取更多信息,祝你好运!

【讨论】: