【问题标题】:MacOS: How to fix error PIP installing with python 3.7.4MacOS:如何修复使用 python 3.7.4 安装的错误 PIP
【发布时间】:2019-08-29 23:18:26
【问题描述】:

当我尝试在 MacOS Mojave 上安装 pip 时出现下一个错误

我尝试使用

解决它
$ brew install python 

但它不起作用

$ python --version

Python 3.7.4

$ sudo python get-pip.py 
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pip
  WARNING: 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
  ERROR: Could not find a version that satisfies the requirement pip (from versions: none)
ERROR: No matching distribution found for pip
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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

【问题讨论】:

  • 这对我来说似乎很离谱。 Homebrew 中的 Python 3 肯定带有 ssl 支持。而且我很确定它也安装了一个 pip 版本。虽然它们被称为 python3 和 pip3。

标签: python python-3.x macos pip


【解决方案1】:

如果 Homebrew 安装 python 成功的话,很可能 pip 已经安装了。

The Hitchhiker's Guide to Python 指出,通过 Homebrew 安装 Python 时,“Homebrew [自动] 为您安装指向 Homebrew 的 Python 3 的 pip。”

尝试运行which pipwhich pip3。如果您收到/usr/local/bin/pip/usr/local/bin/pip3 的响应,那么 Homebrew 已经为您安装了 pip。其他尝试brew unlink python3 && brew link python3

为了清楚起见,请参阅上述指南:

$ python 将启动 Homebrew 安装的 Python 3 解释器。

$ python2 将启动 Homebrew 安装的 Python 2 解释器(如果有)。

$ python3 将启动 Homebrew 安装的 Python 3 解释器。

据我所知,pippip2pip3 也会这样做。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-11
    • 2019-12-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多