您现在的位置是:网站首页>文章详情文章详情
docker中使用cv2模块出现No such file or director
inlike2022-09-14【
原创文章
】
浏览(1794)
评论(0)
喜欢(12)
简介在docker容器中使用cv2模块,出现ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory 的错误
出现该错误的解决方法一般是在Dockerfile文件中增加下面两行执行命令:
RUN apt-get update
RUN apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6
上面两条命令执行时,可能出现网络问题,执行不下去,因此需要考虑第二种备用方案,那就是执行apt-get源之后再使用命令:
RUN cd /etc/apt
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak
RUN echo "deb http://mirrors.163.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list
RUN echo "deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6
这样就可以快速解决使用opencv-Python模块提示找不到libgthread-2.0.so文件的问题。
标签
相关文章
本栏推荐
![Fiddler请求生成代码插件](/media/upfiles/1/f71d2ffd5a7f2da3febbdbc3dca68e5521.png)
标签云
猜你喜欢
站点信息
- 建站时间:2019-5-24
- 网站程序:like in love
- 主题模板:《今夕何夕》
- 文章统计:104条
- 文章评论:***条
- 微信公众号:扫描二维码,关注我们
![个人微信公众号](/static/images/wxgzh.jpg)