【问题标题】:OpenCV install: deprecation errorOpenCV 安装:弃用错误
【发布时间】:2018-06-17 20:58:52
【问题描述】:

我想在 python 中使用 opencv,但我认为我的 numpy 版本有问题。 如何确保 opencv 使用正确的 numpy 版本?

我做到了

sudo pip install opencv-python

我收到了这条消息

Installing collected packages: numpy, opencv-python
Found existing installation: numpy 1.8.0rc1
DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling numpy-1.8.0rc1:
  Successfully uninstalled numpy-1.8.0rc1
Successfully installed numpy-1.14.5 opencv-python-3.4.1.15

现在当我尝试时

import cv2

我明白了

ImportError: numpy.core.multiarray failed to import

我还用

更新了我的 numpy 版本
sudo pip install -U numpy

【问题讨论】:

    标签: python numpy opencv installation


    【解决方案1】:

    如果您在您的机器上同时使用 Py2.7 和 3.5,请通过执行 python3 -m pip install numpy -I 确保为正确版本安装 numpy 或python2 -m pip install numpy -I

    【讨论】:

    • 对我用python3重新安装了numpy和opencv,现在我可以导入cv2了。谢谢
    猜你喜欢
    • 1970-01-01
    • 2015-05-11
    • 2016-12-26
    • 2012-05-26
    • 1970-01-01
    • 2013-05-02
    • 2015-12-21
    • 2017-11-06
    • 1970-01-01
    相关资源
    最近更新 更多