python - ld : can't find -lGL error during installation

标签 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 .奇怪的是,这不会返回任何东西。

我也尝试直接创建符号链接(symbolic link):
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

任何建议表示赞赏。

最佳答案

也许您的 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?

关于python - ld : can't find -lGL error during installation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59016606/

相关文章:

python - 在 Ubuntu Mate (Raspberry Pi 3) 和 python 中使用多个超声波传感器

ubuntu - apt-get update'返回非零代码: 100

assembly - Shellcode:非法指令

python - 在 Python 和 Marshmallow 中嵌套数据库中不存在的字段

Python Pandas 去除异常值与 Nan 异常值

php - 要启用扩展,请验证它们是否已在这些 .ini 文件中启用 - Vagrant/Ubuntu/Magento 2.0.2

c++ - 在 C++ 中嵌套在模板中的类中使用基类的成员时出错

python - 过采样 Numpy 数组(二维)

python - Groupby相邻行 Pandas 的条件总和

c - 替换 __aeabi_dsub 以节省空间(-flto 问题)