Linux下 PyopenGL运行libGL-anaconda报错,解决方案

上一级页面:index-wsl

前言

在Deepin下运行Python的pyopengl库的时候,会莫名其妙的出现如下错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 156 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 49
Current serial number in output stream: 48
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 156 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 48
Current serial number in output stream: 49

解决方案

根据网上的资料是Anaconda(我使用的是这个商业的python发行版)里面的libstdc++.so文件的问题,它关联不到系统的该驱动,所以我们把它移除,使用Linux自带的libstdc++.so 创建一个软链接在该处。

在shell 执行如下代码

1
2
3
4
5
6
7
8
9
#进入Anaconda libstdc++的存放位置

cd ~/anaconda3-4.4.0/lib/
mkdir backup #新建一个文件夹保留原来的libstdc++
mv libstd* backup #将所有libstdc++文件考入文件夹 包括 软链接
#拷贝系统的c++动态链接库在此处
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./
ln -s libstdc++.so.6 libstdc++.so
ln -s libstdc++.so.6 libstdc++.so.6.0.19

问题解决

参考、引用、致谢

Linux下 PyopenGL运行libGL报错,解决方案_acsunqi的博客-CSDN博客