简体   繁体   English

如何在 python 3.8 中安装 opencv-python

[英]How to install opencv-python in python 3.8

I'm having problem during the installation of opencv-python in pycharm.我在 pycharm 中安装 opencv-python 时遇到问题。 After opening pycharm I click on settings and then project interpreter, I click on '+' and search for the correct module, I started the installation but it fails with打开 pycharm 后,我点击设置,然后点击项目解释器,点击“+”并搜索正确的模块,我开始安装,但它失败了

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

Additionally I tried installing it through console but I get the same error.另外我尝试通过控制台安装它,但我得到了同样的错误。 I also have updated to the last pip version, how can I solve this?我也更新到了最后一个 pip 版本,请问如何解决?

EDIT / UPDATE: You can now install through pip , support was added to python 3.8编辑/更新:您现在可以通过pip安装,支持已添加到 python 3.8

OpenCV is not yet (officially) compatible with python 3.8. OpenCV 尚未(正式)与 python 3.8 兼容。 this version of python is quite new and lots of pip packages can't be installed on it (yet).这个版本的 python 是相当新的,很多 pip 包不能安装在它上面(还)。 You can verify that at the bottom of the PyPi page for OpenCV您可以在PyPi 页面底部验证 OpenCV

Three possible solutions:三种可能的解决方案:

  1. Downgrade to python 3.7.5 and install the package through pip as you normally would, and wait for an officially supported version before trying again with python 3.8 Downgrade to python 3.7.5 and install the package through pip as you normally would, and wait for an officially supported version before trying again with python 3.8
  2. Try building OpenCV from source files yourself.尝试自己从源文件构建 OpenCV。 This might require quite a bit of technical knowledge and might ultimately fail anyway without some changes to the source.这可能需要相当多的技术知识,并且最终可能会在不更改源代码的情况下最终失败。 If you're interested in that solution, start here for windows or here for linux如果您对该解决方案感兴趣,请从这里开始 windows 或从这里开始 linux
  3. There is a pre-built wheel available here that works with python 3.8, but it is unofficial (but the source here is quite credible) - this is probably the easiest choice to set up这里有一个可与 python 3.8 一起使用的预制轮,但它是非官方的(但这里的来源非常可信) - 这可能是最简单的设置选择

Also, you can track when support will come to python 3.8 in this GitHub issue此外,您可以在此 GitHub 问题中跟踪何时支持 python 3.8

the solution to use in 3.8 is to download the.whl and install it with pip example: pip install D: \ downloads \ opencv_python-4.2.0-cp38-cp38-win_amd64.whl在 3.8 中使用的解决方案是下载.whl 并使用 pip 安装它 例如:pip install D:\downloads\opencv_python-4.2.0-cp38-cp38-win_amd64.whl

Under python 3.8.在 python 3.8 下。 Open Anaconda prompt Then type: pip install opencv-python打开Anaconda提示然后输入: pip install opencv-python

I hope this is useful for everybody我希望这对每个人都有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM