【问题标题】:Python3 can't see opencv-python, numpy, PyQt5Python3 看不到 opencv-python、numpy、PyQt5
【发布时间】:2019-03-20 04:30:56
【问题描述】:

我使用 brew 安装了 opencv-python numpy PyQt5。不幸的是,它仅在版本 2 中为 python 安装,但我希望它是版本 3。所以通常当我使用 python2 时,我可以导入这些库,但在 python3 中,只有找不到模块的错误。

当我输入例如 brew info numpy 时,我得到如下信息:

numpy: stable 1.15.2 (bottled), HEAD Package for scientific computing with Python https://www.numpy.org/ /usr/local/Cellar/numpy/1.15.2 (967 files, 25.5MB)   Poured from bottle on 2018-10-15 at 12:13:26 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/numpy.rb
    ==> Dependencies Build: gcc ✔ Recommended: python ✔, python@2 ✔
    ==> Options
    --without-python    Build without python support
    --without-python@2  Build without python2 support
    --HEAD  Install HEAD version
    ==> Analytics install: 33,262 (30d), 96,001 (90d), 314,869 (365d) install_on_request: 5,934 (30d), 19,037 (90d), 56,029 (365d) build_error: 0 (30d)

所以你可以看到“推荐”中只有 python2。有没有可能修复这个错误并以某种方式将这些库链接到 python3?

我正在使用 macOS High Sierra。

【问题讨论】:

    标签: python python-3.x macos numpy opencv


    【解决方案1】:

    为什么不使用pip3 为python3 安装包? Brew 用于安装应用程序,而不是库。

    【讨论】:

    • 使用 pip3 我总是遇到类似的错误:“MacBook-Pro:~ mok$ pip3 install numpy Collecting numpy could not fetch URL pypi.python.org/simple/numpy: 确认 ssl 证书时出现问题:[SSL: TLSV1_ALERT_PROTOCOL_VERSION ] tlsv1 警报协议版本 (_ssl.c:645) - 跳过找不到满足 numpy 要求的版本(来自版本:)没有找到与 numpy 匹配的分布”
    【解决方案2】:

    问题解决了。最近,Python.org 站点停止支持 TLS 版本 1.0 和 1.1。这有帮助:

    curl https://bootstrap.pypa.io/get-pip.py | python3
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      • 1970-01-01
      • 1970-01-01
      • 2018-03-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多