如何在Windows上安装OpenCV并在不使用包管理器的情况下为PyCharm启用它

时间:2023-01-24 00:26:19

I am trying to install and use OpenCV library for python development. I want to use it for PyCharm IDE. I am trying to do it without the package manager.

我正在尝试安装和使用OpenCV库进行python开发。我想将它用于PyCharm IDE。我试图在没有包管理器的情况下这样做。

The environment is a windows 64 bit architecture. For Python I am using Python 2.7.10.

环境是Windows 64位架构。对于Python,我使用的是Python 2.7.10。

I have already included the OpenCV directory in the system path.

我已经在系统路径中包含了OpenCV目录。

I am using python 2.7.10 interpreter for PyCharm and have installed the pip and numpy packages.

我正在为PyCharm使用python 2.7.10解释器并安装了pip和numpy包。

opencv version is 3.0.0

opencv版本是3.0.0

How do I enable OpenCV and make it working in PyCharm?

如何启用OpenCV并使其在PyCharm中运行?

1 个解决方案

#1


18  

I finally figured out on how to solve this issue:

我终于想出了如何解决这个问题:

Steps to follow:

要遵循的步骤:

  1. Install Python 2.7.10
  2. 安装Python 2.7.10

  3. Install Pycharm(If you have not done it already)
  4. 安装Pycharm(如果你还没有这样做)

  5. Download and install the OpenCV executable.
  6. 下载并安装OpenCV可执行文件。

  7. Add OpenCV in the system path(%OPENCV_DIR% = /path/of/opencv/directory)
  8. 在系统路径中添加OpenCV(%OPENCV_DIR%= / path / of / opencv / directory)

  9. Goto C:\opencv\build\python\2.7\x86 folder and copy cv2.pyd file.
  10. 转到C:\ opencv \ build \ python \ 2.7 \ x86文件夹并复制cv2.pyd文件。

  11. Goto C:\Python27\DLLs directory and paste the cv2.pyd file.
  12. 转到C:\ Python27 \ DLLs目录并粘贴cv2.pyd文件。

  13. Goto C:\Python27\Lib\site-packages directory and paste the cv2.pyd file.
  14. 转到C:\ Python27 \ Lib \ site-packages目录并粘贴cv2.pyd文件。

  15. Goto PyCharm IDE and goto DefaultSettings>PythonInterpreter.
  16. 转到PyCharm IDE并转到DefaultSettings> PythonInterpreter。

  17. Select the Python which you have installed on Step1.
  18. 选择Step1上安装的Python。

  19. Install the packages numpy,matplotlib and pip in pycharm.
  20. 在pycharm中安装包numpy,matplotlib和pip。

  21. Restart your PyCharm.
  22. 重启你的PyCharm。

  23. PyCharm now has OpenCV library installed and working.
  24. PyCharm现在已经安装并运行了OpenCV库。

#1


18  

I finally figured out on how to solve this issue:

我终于想出了如何解决这个问题:

Steps to follow:

要遵循的步骤:

  1. Install Python 2.7.10
  2. 安装Python 2.7.10

  3. Install Pycharm(If you have not done it already)
  4. 安装Pycharm(如果你还没有这样做)

  5. Download and install the OpenCV executable.
  6. 下载并安装OpenCV可执行文件。

  7. Add OpenCV in the system path(%OPENCV_DIR% = /path/of/opencv/directory)
  8. 在系统路径中添加OpenCV(%OPENCV_DIR%= / path / of / opencv / directory)

  9. Goto C:\opencv\build\python\2.7\x86 folder and copy cv2.pyd file.
  10. 转到C:\ opencv \ build \ python \ 2.7 \ x86文件夹并复制cv2.pyd文件。

  11. Goto C:\Python27\DLLs directory and paste the cv2.pyd file.
  12. 转到C:\ Python27 \ DLLs目录并粘贴cv2.pyd文件。

  13. Goto C:\Python27\Lib\site-packages directory and paste the cv2.pyd file.
  14. 转到C:\ Python27 \ Lib \ site-packages目录并粘贴cv2.pyd文件。

  15. Goto PyCharm IDE and goto DefaultSettings>PythonInterpreter.
  16. 转到PyCharm IDE并转到DefaultSettings> PythonInterpreter。

  17. Select the Python which you have installed on Step1.
  18. 选择Step1上安装的Python。

  19. Install the packages numpy,matplotlib and pip in pycharm.
  20. 在pycharm中安装包numpy,matplotlib和pip。

  21. Restart your PyCharm.
  22. 重启你的PyCharm。

  23. PyCharm now has OpenCV library installed and working.
  24. PyCharm现在已经安装并运行了OpenCV库。