在Pycharm中导入OpenCV [复制]

问题描述 投票:0回答:1

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

任何人都可以帮我解决这个问题吗?

opencv pycharm
1个回答
0
投票

请参阅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,那么你可以在满意之后输入:pip install opencv-python,

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

搜索opencv-python并安装包。

© www.soinside.com 2019 - 2024. All rights reserved.