gpt4 book ai didi

python - 安装 mediapipe 库后 cv2 不工作

转载 作者:行者123 更新时间:2023-12-01 22:58:02 26 4
gpt4 key购买 nike

我想使用 python 制作 handtracker 程序,但教程告诉我安装 mediapipe 库,然后我安装了它。在此之前可以使用 cv2 流式传输我的相机,但是在安装 mediapipe 之后,cv2 不起作用这里的消息:

>>>import cv2
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv2
File "C:\Users\windows\AppData\Local\Programs\Python\Python39\lib\site-packages\cv2\__init__.py", line 181, in <module>
bootstrap()
File "C:\Users\windows\AppData\Local\Programs\Python\Python39\lib\site-packages\cv2\__init__.py", line 175, in bootstrap
if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
File "C:\Users\windows\AppData\Local\Programs\Python\Python39\lib\site-packages\cv2\__init__.py", line 28, in __load_extra_py_code_for_module
py_module = importlib.import_module(module_name)
File "C:\Users\windows\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\windows\AppData\Local\Programs\Python\Python39\lib\site-packages\cv2\gapi\__init__.py", line 290, in <module>
cv.gapi.wip.GStreamerPipeline = cv.gapi_wip_gst_GStreamerPipeline
AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import) ```

我尝试再次安装 opencv 但总是收到此消息:

Requirement already satisfied: numpy>=1.19.3 in c:\users\windows\appdata\local\programs\python\python39\lib\site-packages (from opencv-python) (1.21.1)

但问题依然存在。我该如何解决?

已编辑:这是我的 pip 列表

C:\Users\windows>pip list
Package Version
--------------------- --------
absl-py 1.1.0
attrs 21.4.0
cycler 0.11.0
fonttools 4.33.3
kiwisolver 1.4.2
matplotlib 3.5.2
mediapipe 0.8.10
numpy 1.21.1
opencv-contrib-python 4.6.0.66
opencv-python 4.5.3.56
packaging 21.3
Pillow 8.3.1
pip 22.1.2
protobuf 4.21.1
pygame 2.1.2
pyparsing 3.0.9
python-dateutil 2.8.2
pyzbar 0.1.8
setuptools 56.0.0
six 1.16.0

最佳答案

我和上面的情况一样你可以试试:

pip install "opencv-python-headless<4.3"

这个命令已经成功解决了这种情况

引用:https://github.com/Rudrabha/Wav2Lip/issues/387

关于python - 安装 mediapipe 库后 cv2 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72545779/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com