且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

导入 CV2 时收到来自 lingnutls/'Hogweed' 的错误

更新时间:2022-06-17 10:09:42

最近发布的用于 Conda 的 opencv 包似乎存在问题.我测试了所有4.x版本,发现问题出现从 4.3 开始.除非你真的依赖 >=4.3,否则强制使用 4.3 之前的版本可以解决问题,

There seems to be a problem with the recent releases of opencv packages for Conda. I have tested all the 4.x releases and found that the problem occurs starting from 4.3. Unless you really depend on >=4.3, forcing a version prior to 4.3 solves the problem,

name: test
channels:
 - anaconda
 - conda-forge
dependencies:
 - python>=3.8
 - opencv<4.3

在我的情况下,这安装了 4.2.0.然后在 Python 中导入 cv2 工作正常.请注意,使用 conda update 对我不起作用,我仍然遇到错误,但我必须先 删除环境,然后重新创建它.我认为这种行为表明错误根源于 opencv 的某些依赖,当使用 conda update 时,它没有正确降级.

in my cases this installed 4.2.0. Importing cv2 in Python works fine then. Note that using conda update didn't work for me and I still got the error, but I had to first remove the environment and then re-create it. I think this behavior indicates that the error is rooted in some dependency of opencv, which is not properly down-graded when conda update is used.