ubuntu解决OpenCV安装的问题libGL.so.1和libgthread-2.0.so.0

解决:ImportError: libGL.so.1: cannot open shared object file: No such file or directory

apt update
apt install libgl1-mesa-glx

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

apt-get install libglib2.0-dev

可能会遇到下面的问题:

E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal Release' does not have a Release file.

或者

E: Unable to locate package libgl1-mesa-glx

这两个个报错是清华源的问题,换用阿里云的就没有了,用vim打开/etc/apt/sources.list这个文件,把里面的东西都删掉,复制阿里云源进去,保存就好了,后边的安装就正常。

vim /etc/apt/sources.list  

进入sources.list文件,按两下 d 键,删除一行,直到所有的都删除。然后按一下 i 键,进入编辑模式,把下边的源复制进去,然后按esc键退出编辑模式,按 :wq 保存并退出。

#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

感觉对你有帮助,就点个赞吧>_<

你可能感兴趣的:(环境配置,服务器,ubuntu,运维)