首页 > 解决方案 > 如何在 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:无法打开共享对象文件:没有这样的文件或目录

标签: wxpythonpython-3.6libjpeg

解决方案


我通常会做以下事情:

pip3 install wxPython

如果这不起作用,那么您可能没有安装 wxPython 的依赖项之一:

我注意到在 Ubuntu 上我有时需要安装 webkit、opengl 等来安装 wxPython。您的错误消息甚至提到缺少 OpenGL,所以我将从那里开始。


推荐阅读