Error while installing cv2 in pycharm - python 3.5.3

旧城冷巷雨未停 提交于 2019-12-12 18:19:24

问题


I am getting error while installing cv2 package from project interpreter.

Error occured: Non zero exit code(1)

When I execute command, pip install cv2..it gives error as,

Could not find a version that satisfies the requirement cv2(from versions: )No matching distribution found for cv2

Please help me solve this error.


回答1:


The package name is actually opencv-python. So you should do:

pip install opencv-python

However, the package is only available on pypi for version 3, not for version 2. I think the misunderstanding could come from when you are actually importing the package you do:

`import cv2`

But that is actually not the package name on pypi. See the documentation on pypi for more details.




回答2:


In pycharm go to :

  1. File
  2. Settings
  3. Expand Project : [your project name]
  4. Select "project Interpreter"
  5. In the top right corner of the grid listing the packages, click the green plus button A popup "Available packages" will appear

  6. If no package is available in the list in the left, click the "Manage repositories" button, add this package URL (https://pypi.python.org/simple), then restart pycharm (You may also need to update pycharm to the lastest version, there was a bug here)

  7. In the search box type "opencv-python"

  8. Select the "opencv-python" package in the list and click the "Install Package" button in the bottom left of the popup

  9. Now go back to your code, it will no longer comply about the missing cv2



回答3:


Easy Way to go .. You can follow these steps:

  1. Open Settings in Pycharm.
  2. In Settings, on left there will be an option of Project: Your Project Name.
  3. Press it and then inside it click Project Interpreter.
  4. Now there will be a plus sign over right frame.
  5. Press that sign and write opencv-python and then install the package.

write import cv2 in your program to use it.



来源:https://stackoverflow.com/questions/47390692/error-while-installing-cv2-in-pycharm-python-3-5-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!