【问题标题】:Import OpenCV in Pycharm [duplicate]在 Pycharm 中导入 OpenCV [重复]
【发布时间】:2015-04-14 08:37:28
【问题描述】:

我想在 pycharm 中使用 OpenCV(Python 模块)。我在设置中设置了我的 Python 解释器,并将 OpenCV 路径 (C:\opencv\build\python\2.7) 添加到 Python 解释器路径中。不幸的是 pycharm 无法导入 OpenCV。很明显,我在左侧面板(项目面板)中看到了cv2.pyd

谁能帮我解决这个问题?

【问题讨论】:

    标签: opencv pycharm


    【解决方案1】:

    参考How to install OpenCV on Windows and enable it for PyCharm without using the package manager

    要遵循的步骤:

    Install Python 2.7.10
    Install Pycharm(If you have not done it already)
    Download and install the OpenCV executable.
    Add OpenCV in the system path(%OPENCV_DIR% = /path/of/opencv/directory)
    Goto C:\opencv\build\python\2.7\x86 folder and copy cv2.pyd file.
    Goto C:\Python27\DLLs directory and paste the cv2.pyd file.
    Goto C:\Python27\Lib\site-packages directory and paste the cv2.pyd file.
    Goto PyCharm IDE and goto DefaultSettings>PythonInterpreter.
    Select the Python which you have installed on Step1.
    Install the packages numpy,matplotlib and pip in pycharm.
    Restart your PyCharm.
    PyCharm now has OpenCV library installed and working.
    

    如果你已经安装了 pycharm,那么你可以输入: 点安装 opencv-python 满意后,

    然后转到文件,设置(在pycharm中) 项目,项目解释器,点击右上角的加号,

    搜索 opencv-python 并安装包。

    【讨论】:

      猜你喜欢
      • 2020-06-13
      • 2020-04-07
      • 2021-11-01
      • 2016-09-05
      • 1970-01-01
      • 2013-06-01
      • 2021-11-24
      • 2020-07-19
      • 2020-08-18
      相关资源
      最近更新 更多