【问题】
在docker容器内直接pip安装opencv-python:

pip install opencv-python

再import cv2时会报错:

ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory

【解决方法】
在容器内不能用上述方法安装,需要先卸载原有的cv2:

pip uninstall opencv-python

再用一下命令安装即可:

pip install opencv-python-headless

【参考】
https://blog.csdn.net/Max_ZhangJF/article/details/108920050
https://github.com/Korea-Health-Datathon/KHD2020/issues/78

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐