我正在尝试安装pip3
Python 包wxpython
,但由于以下原因失败
g++ -shared -fPIC -o /tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib/libwx_gtk3u_gl-3.0.so.0.4.0 gldll_glcmn.o gldll_glx11.o gldll_gtk_glcanvas.o -L/tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib -Wl,-soname,libwx_gtk3u_gl-3.0.so.0 -pthread -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgthread-2.0 -pthread -lglib-2.0 -lX11 -lXxf86vm -lSM -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lnotify -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lpng -lz -ljpeg -ltiff -lwxregexu-3.0 -pthread -Wl,--version-script,/tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/version-script -lz -ldl -lm -lwx_gtk3u_core-3.0 -lwx_baseu-3.0 -lGL -lGLU -lz -ldl -lm
(cd /tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib/; rm -f libwx_gtk3u_html-3.0.so libwx_gtk3u_html-3.0.so.0; ln -s libwx_gtk3u_html-3.0.so.0.4.0 libwx_gtk3u_html-3.0.so.0; ln -s libwx_gtk3u_html-3.0.so.0 libwx_gtk3u_html-3.0.so)
(cd /tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib/; rm -f libwx_gtk3u_stc-3.0.so libwx_gtk3u_stc-3.0.so.0; ln -s libwx_gtk3u_stc-3.0.so.0.4.0 libwx_gtk3u_stc-3.0.so.0; ln -s libwx_gtk3u_stc-3.0.so.0 libwx_gtk3u_stc-3.0.so)
(cd /tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib/; rm -f libwx_gtk3u_webview-3.0.so libwx_gtk3u_webview-3.0.so.0; ln -s libwx_gtk3u_webview-3.0.so.0.4.0 libwx_gtk3u_webview-3.0.so.0; ln -s libwx_gtk3u_webview-3.0.so.0 libwx_gtk3u_webview-3.0.so)
/usr/bin/x86_64-linux-gnu-ld: -lGL kann nicht gefunden werden
collect2: error: ld returned 1 exit status
Makefile:16113: recipe for target '/tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib/libwx_gtk3u_gl-3.0.so.0.4.0' failed
make: *** [/tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib/libwx_gtk3u_gl-3.0.so.0.4.0] Error 1
make: *** Auf noch nicht beendete Prozesse wird gewartet …
(cd /tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib/; rm -f libwx_gtk3u_adv-3.0.so libwx_gtk3u_adv-3.0.so.0; ln -s libwx_gtk3u_adv-3.0.so.0.4.0 libwx_gtk3u_adv-3.0.so.0; ln -s libwx_gtk3u_adv-3.0.so.0 libwx_gtk3u_adv-3.0.so)
g++ -o wxrc wxrc_wxrc.o -L/tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/lib -pthread -lwx_baseu_xml-3.0 -lexpat -lwx_baseu-3.0 -lwxregexu-3.0 -pthread -Wl,--version-script,/tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/version-script -lz -ldl -lm -lz -ldl -lm
make[1]: Verzeichnis „/tmp/pip-build-c0hbjq4b/wxpython/build/wxbld/gtk3/utils/wxrc“ wird verlassen
Error building
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "build.py", line 1295, in cmd_build_wx
wxbuild.main(wxDir(), build_options)
File "/tmp/pip-build-c0hbjq4b/wxpython/buildtools/build_wxwidgets.py", line 498, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "/tmp/pip-build-c0hbjq4b/wxpython/buildtools/build_wxwidgets.py", line 85, in exitIfError
raise builder.BuildError(msg)
buildtools.builder.BuildError: Error building
Finished command: build_wx (3m27.477s)
Finished command: build (3m27.478s)
Command '"/usr/bin/python3" -u build.py build' failed with exit code 1.
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-c0hbjq4b/wxpython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-dt7af70p-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-c0hbjq4b/wxpython/
libgl-dev
指的libgl1-mesa-dev
是已经安装的以及libglw1-mesa-dev
基于自动完成功能的唯一其他可能的候选者sudo apt-get install libgl
。
pip
Python 2.x安装成功。
答案1
这其实是两个问题。如果我从字面上理解你的问题,那么一种方法就是apt-file
搜索包含你要查找的文件的包:
$ apt-file search libGL.so
libgl1: /usr/lib/x86_64-linux-gnu/libGL.so.1
libgl1: /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
libglvnd-dev: /usr/lib/x86_64-linux-gnu/libGL.so
nvidia-340: /usr/lib/i386-linux-gnu/libGL.so
nvidia-340: /usr/lib/i386-linux-gnu/libGL.so.1
nvidia-340: /usr/lib/i386-linux-gnu/libGL.so.340.106
nvidia-340: /usr/lib/x86_64-linux-gnu/libGL.so
nvidia-340: /usr/lib/x86_64-linux-gnu/libGL.so.1
nvidia-340: /usr/lib/x86_64-linux-gnu/libGL.so.340.106
primus-libs: /usr/lib/x86_64-linux-gnu/primus/libGL.so.1
virtualbox-guest-x11: /usr/lib/virtualbox/additions/libGL.so
virtualbox-guest-x11: /usr/lib/virtualbox/additions/libGL.so.1
virtualbox-guest-x11-hwe: /usr/lib/virtualbox/additions/libGL.so
virtualbox-guest-x11-hwe: /usr/lib/virtualbox/additions/libGL.so.1
如果你还没有安装 apt-file,请先安装它并初始化其数据库:
$ sudo apt install apt-file
$ sudo apt-file update
要检查链接器是否真的能找到已安装的库,请运行以下命令:
$ ldconfig -p | grep libGL.so
libGL.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libGL.so.1
libGL.so.1 (libc6) => /usr/lib/i386-linux-gnu/libGL.so.1
libGL.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libGL.so
至于为什么使用 pip3 构建的 wxPython 没有选择它们中的任何一个,这是一个我无法回答的问题。
答案2
我遇到了同样的问题。apt 说libgl1-mesa-dev
已经安装了,但我找不到包/var/cache/apt
。
这有帮助:
sudo apt-get remove --purge libgl1-mesa-dev
(此后,请勿制作sudo apt autoremove
。)
sudo apt-get install libgl1-mesa-dev
此后编译成功。