在linux中安装好opencv包之后,导入cv2报如下错误:
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
import cv2
File "/usr/local/lib/python3.9/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/usr/local/lib/python3.9/site-packages/cv2/__init__.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
针对这个错误可以重新安装opencv包:文章来源:https://www.toymoban.com/news/detail-657715.html
pip uninstall opencv-python
pip install opencv-python-headless
安装完成后,可以正常导入文章来源地址https://www.toymoban.com/news/detail-657715.html
到了这里,关于python 导入cv2 报错:ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or di的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!