微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法在Ubuntu 18.04中的Python 3.6的虚拟环境中安装wxPython 4.1.0

如何解决无法在Ubuntu 18.04中的Python 3.6的虚拟环境中安装wxPython 4.1.0

我试图在Ubuntu 18.04 OS的python 3.6虚拟环境中安装runsnakerun python库。安装依赖项wxPython-4.1.0时,它给了我错误

2020-08-20T17:53:47,502   Created temporary directory: /tmp/pip-wheel-vkxfnlv5
2020-08-20T17:53:47,502   Destination directory: /tmp/pip-wheel-vkxfnlv5
2020-08-20T17:53:47,502   Running command /home/poyu_kao/.virtualenvs/py36/bin/python -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-t25ch5cu/wxpython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-t25ch5cu/wxpython/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-vkxfnlv5
2020-08-20T17:53:47,794   running bdist_wheel
2020-08-20T17:53:47,795   running build
2020-08-20T17:53:47,795   WARNING: Building this way assumes that all generated files have been
2020-08-20T17:53:47,795   generated already.  If that is not the case then use build.py directly
2020-08-20T17:53:47,795   to generate the source and perform the build stage.  You can use
2020-08-20T17:53:47,796   --skip-build with the bdist_* or install commands to avoid this
2020-08-20T17:53:47,796   message and the wxWidgets and Phoenix build steps in the future.

2020-08-20T17:53:51,080   *** Could not run GTK+ test program,checking why...
2020-08-20T17:53:51,092   *** The test program Failed to compile or link. See the file config.log for the
2020-08-20T17:53:51,092   *** exact error that occurred. This usually means GTK+ is incorrectly installed.
2020-08-20T17:53:51,094   configure: error:
2020-08-20T17:53:51,094   The development files for GTK+ were not found. For GTK+ 2,please
2020-08-20T17:53:51,094   ensure that pkg-config is in the path and that gtk+-2.0.pc is
2020-08-20T17:53:51,094   installed. For GTK+ 1.2 please check that gtk-config is in the path,2020-08-20T17:53:51,094   and that the version is 1.2.3 or above. Also check that the
2020-08-20T17:53:51,094   libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
2020-08-20T17:53:51,094   --libs' are in the LD_LIBRARY_PATH or equivalent.

2020-08-20T17:53:51,135   Error running configure
2020-08-20T17:53:51,135   ERROR: Failed building wxWidgets
2020-08-20T17:53:51,136   Traceback (most recent call last):
2020-08-20T17:53:51,136     File "build.py",line 1471,in cmd_build_wx
2020-08-20T17:53:51,136       wxbuild.main(wxDir(),build_options)
2020-08-20T17:53:51,136     File "/tmp/pip-install-t25ch5cu/wxpython/buildtools/build_wxwidgets.py",line 373,in main
2020-08-20T17:53:51,136       "Error running configure")
2020-08-20T17:53:51,line 85,in exitIfError
2020-08-20T17:53:51,136       raise builder.BuildError(msg)
2020-08-20T17:53:51,136   buildtools.builder.BuildError: Error running configure
2020-08-20T17:53:51,136   Finished command: build_wx (0m3.136s)
2020-08-20T17:53:51,136   Finished command: build (0m3.136s)
2020-08-20T17:53:51,143   Command '"/home/poyu_kao/.virtualenvs/py36/bin/python" -u build.py build' Failed with exit code 1.
2020-08-20T17:53:51,161   ERROR: Failed building wheel for wxPython
2020-08-20T17:53:51,162   Running setup.py clean for wxPython
2020-08-20T17:53:51,162   Running command /home/poyu_kao/.virtualenvs/py36/bin/python -u -c 'import sys,'"'"'exec'"'"'))' clean --all
2020-08-20T17:53:51,390   running clean
2020-08-20T17:53:51,390   'build/lib.linux-x86_64-3.6' does not exist -- can't clean it
2020-08-20T17:53:51,390   'build/bdist.linux-x86_64' does not exist -- can't clean it
2020-08-20T17:53:51,390   'build/scripts-3.6' does not exist -- can't clean it
2020-08-20T17:53:51,406 Failed to build wxPython

然后,我尝试使用pip install wxPython安装wxPython-4.1.0,这给了我错误。有人可以帮我安装该库吗?

解决方法

最后,我成功使用Python 3.6虚拟环境将wxPython库安装了

pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。