ld:在安装过程中找不到-lGL错误

时间:2019-11-24 10:14:50

标签: python ubuntu gcc conda

我正在尝试安装mujoco-py并在编译后得到它:

  /home/ubuntu/anaconda3/compiler_compat/ld: cannot find -lGL
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mujoco-py
  Running setup.py clean for mujoco-py
  Failed to build mujoco-py
  ERROR: Could not build wheels for mujoco-py which use PEP 517 and cannot be installed directly

我正在使用Ubuntu 18.04,Python 3.6.9。


在此question之后,我安装了建议的库 ,但事实证明它已安装。

(test_env) ubuntu@user:~$ sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libglfw3 is already the newest version (3.2.1-1).
libgl1-mesa-glx is already the newest version (19.0.8-0ubuntu0~18.04.3).
libosmesa6-dev is already the newest version (19.0.8-0ubuntu0~18.04.3).
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

然后我尝试第二个答案并运行locate libGL。奇怪的是,这什么都不返回。

我也尝试直接创建符号链接:

sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

但是:

ln: failed to create symbolic link '/usr/lib/x86_64-linux-gnu/libGL.so': File exists

~$ ls -h /usr/lib/x86_64-linux-gnu | grep "libGL"
libGL.la
libGL.so
libGL.so.1
libGL.so.1.7.0
libGLESv1_CM.so
libGLESv1_CM.so.1
libGLESv1_CM.so.1.0.0
libGLESv1_CM.so.1.2.0
libGLESv1_CM_nvidia.so.1
libGLESv1_CM_nvidia.so.418.87.01
libGLESv2.so
libGLESv2.so.2
libGLESv2.so.2.0.0
libGLESv2.so.2.1.0
libGLESv2_nvidia.so.2
libGLESv2_nvidia.so.418.87.01
libGLEW.so
libGLEW.so.2.0
libGLEW.so.2.0.0
libGLU.a
libGLU.so
libGLU.so.1
libGLU.so.1.3.1
libGLX.so
libGLX.so.0
libGLX_indirect.so.0
libGLX_mesa.so.0
libGLX_mesa.so.0.0.0
libGLX_nvidia.so.0
libGLX_nvidia.so.418.87.01
libGLdispatch.so
libGLdispatch.so.0

任何建议都值得赞赏。

1 个答案:

答案 0 :(得分:0)

也许您的 Anaconda 太旧(或 setup.py 的软件包最初不正确)并且也受到此错误的影响: https://github.com/cocodataset/cocoapi/issues/94

为了安装人们推荐添加的软件包 extra_link_args=['-L/usr/lib/x86_64-linux-gnu/']

另见How to set extra link argument in Python module setup?