wxpython - 如何在 linux 中使用 python3 安装 wxpython?,给我错误
问题描述
错误
检查 GL/gl.h... 没有配置:错误:OpenGL 库不可用 运行配置时出错 错误:构建 wxWidgets Traceback 失败(最后一次调用):文件“build.py”,第 1321 行,在 cmd_build_wx wxbuild.main (wxDir(),build_options)文件“/tmp/pip-build-1v9li5h1/wxpython/buildtools/build_wxwidgets.py”,第375行,在主“运行配置时出错”)文件“/tmp/pip-build-1v9li5h1/wxpython /buildtools/build_wxwidgets.py",第 85 行,在 exitIfError 中引发 builder.BuildError(msg) buildtools.builder.BuildError: Error running configure Finished command: build_wx (0m5.163s) Finished command: build (0m5.163s) Command '" /usr/bin/python3" -u build.py build' 失败,退出代码为 1。
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1v9li5h1/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-nsn2w9dk-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-1v9li5h1/wxpython/
~ » python3
XXX-PC
Python 3.6.5 (default, May 11 2018, 13:30:17)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import sys
import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xxx/.local/lib/python3.6/site-packages/wx/__init__.py", line 17, in <module>
from wx.core import *
File "/home/xxx/.local/lib/python3.6/site-packages/wx/core.py", line 12, in <module>
from ._core import *
ImportError:libjpeg.so.8:无法打开共享对象文件:没有这样的文件或目录
解决方案
我通常会做以下事情:
pip3 install wxPython
如果这不起作用,那么您可能没有安装 wxPython 的依赖项之一:
我注意到在 Ubuntu 上我有时需要安装 webkit、opengl 等来安装 wxPython。您的错误消息甚至提到缺少 OpenGL,所以我将从那里开始。
推荐阅读
- python - Python 彩票程序 - 如何比较随机列表?
- visual-studio-code - 我可以从 vscode task.json 的删除双引号中保存吗?
- javascript - 任何人都可以协助处理与 discord.js 相关的似乎无法正常工作的代码吗?
- javascript - socket.rooms 值在“断开”侦听器完成之前更改
- python - 气流 mysql_hook 没有名为“MySQLdb”的模块
- python - 按类计算以大写单词开头的行数
- c++ - 如何链接和编译库?(C++)
- semantic-versioning - [major].[minor].[patch] 的最大数量
- python - Flask 错误:“方法不允许 请求的 URL 不允许该方法”
- ubuntu-16.04 - 在 /media/root/disk 挂载 /dev/loop0 时出错