在 ubuntu 14.04 上安装 wxpython
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27240143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing wxpython on ubuntu 14.04
提问by wugology
When I try to open PlayOnLinux from the commandline, I get this error:
当我尝试从命令行打开 PlayOnLinux 时,出现此错误:
Looking for python... 2.7.8 - selected
Traceback (most recent call last):
File "mainwindow.py", line 31, in <module>
import wxversion
ImportError: No module named wxversion
Nearly every forum post I have found has suggested I install wxPython, then links hereor to some other wxpython wiki page. Unfortunately, the entire wxpython wiki website currently says "wxPyWiki is down for troubleshooting" right now.
我发现的几乎每个论坛帖子都建议我安装 wxPython,然后链接到这里或其他一些 wxpython wiki 页面。不幸的是,整个 wxpython wiki 网站目前都说“wxPyWiki 已关闭以进行故障排除”。
I found this StackOverflowquestion, which is basically the same as mine. I tried all the lower-voted comments, and they all appear to work, but import wx
still fails. When I tried the top-rated comment in that thread, I got to step 7 successfully, but then it says
我发现了这个 StackOverflow问题,它与我的基本相同。我尝试了所有投票率较低的评论,它们似乎都有效,但import wx
仍然失败。当我在该线程中尝试评分最高的评论时,我成功地进入了第 7 步,但随后它说
In file included from scr/helpers.cpp:16:0:
include/wx/wxPython/wxPython_int.h:19:19: fatal error: wx/wx.h: No such file or directory
#include <wx/wx.h>
compilation terminated
If anyone has any suggestions for how I can properly install wxPython on Ubuntu, they would be greatly appreciated.
如果有人对我如何在 Ubuntu 上正确安装 wxPython 有任何建议,他们将不胜感激。
EDIT: sudo pip install wxPython
tells me it's already installed ("Requirement already satisfied") and suggests I use --upgrade
. It's not installed, import wx
still fails.
编辑:sudo pip install wxPython
告诉我它已经安装(“要求已经满足”)并建议我使用--upgrade
. 它没有安装,import wx
仍然失败。
EDIT: sudo apt-get install wxpython
gives the error Unable to locate package wxpython
编辑:sudo apt-get install wxpython
给出错误Unable to locate package wxpython
EDIT: I tried sudo apt-get install python-wxglade
and it appeared to work, but playonlinux still gives the same error and import wx
still fails.
编辑:我试过sudo apt-get install python-wxglade
,它似乎工作,但 playonlinux 仍然给出同样的错误,import wx
仍然失败。
EDIT: I tried uninstalling and reinstalling playonlinux and python-wxversion. Both remove/install appeared successful, but I still get the same No module named wxversion
error.
编辑:我尝试卸载并重新安装 playonlinux 和 python-wxversion。删除/安装似乎都成功了,但我仍然遇到相同的No module named wxversion
错误。
EDIT: I tried the solutions posted here(except for reinstalling the OS). They did not work. I'd rather not reinstall Ubuntu.
编辑:我尝试了此处发布的解决方案(重新安装操作系统除外)。他们没有工作。我宁愿不重新安装 Ubuntu。
回答by Muzaffar
Try installing python-wxglade.It must have all necessary wx modules inside.
尝试安装 python-wxglade。它必须包含所有必需的 wx 模块。
回答by Mike Driscoll
Check Synaptic for wxPython 3.x to see if you can install it that way. According to https://www.playonlinux.com/en/news.html, version 4.2.5 of PlayOnLinux supports wxPython 3. If you can't get Synaptic to find a copy of wxPython 3, then you should refer to the official build instructions found here:
检查 Synaptic for wxPython 3.x 以查看您是否可以通过这种方式安装它。根据https://www.playonlinux.com/en/news.html,PlayOnLinux 4.2.5 版本支持 wxPython 3。如果你无法通过 Synaptic 找到 wxPython 3 的副本,那么你应该参考官方构建说明在这里找到:
回答by onerty
wxPython package is named "python-wxgtk2.8" for wxWidgets 2.8 Install it: sudo apt-get install python-wxgtk2.8
wxPython 包命名为“python-wxgtk2.8”,用于 wxWidgets 2.8 安装:sudo apt-get install python-wxgtk2.8
回答by RandomGuy
The answer about installing "python-wxgtk2.8" is correct. But that's if you want to install 2.8, if you want 3.0 in 14.04, you can get it by following this post. I have done that, and have wx 3.0 installed.
关于安装“python-wxgtk2.8”的答案是正确的。但那是如果你想安装 2.8,如果你想在 14.04 安装 3.0,你可以按照这篇文章获得它。我已经这样做了,并安装了 wx 3.0。
回答by dennisobrien
I tried many things, so I'm not sure if this is the minimum set of pre-requisites.
我尝试了很多东西,所以我不确定这是否是最低限度的先决条件。
$ sudo apt-get install libwxbase3.0-dev libwxgtk3.0-dev wx-common libwebkit-dev libwxgtk-webview3.0-dev wx3.0-examples wx3.0-headers wx3.0-i18n libwxgtk-media3.0-dev
Then I pip installed the Phoenix version:
然后我pip安装了Phoenix版本:
$ sudo pip install --upgrade --pre -f http://wxpython.org/Phoenix/snapshot-builds/ --trusted-host wxpython.org wxPython_Phoenix
This installs wxPython via pip, but I don't think it addresses your issue with wxversion
.
这通过 pip 安装 wxPython,但我认为它不能解决您的wxversion
.
回答by EntangledLoops
All you need is:
所有你需要的是:
sudo apt-get install python-wxgtk3.0
sudo apt-get install python-wxgtk3.0
回答by Aryan
Before that install gtk3
在此之前安装 gtk3
$ sudo apt-get install libgtk-3-dev
If you are facing problem to install wxpython on Python3 please use this command to install wxpython
如果您在 Python3 上安装 wxpython 时遇到问题,请使用此命令安装 wxpython
$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython
By this command you can install latest wxPython4 version. If you are using Windows or macOS
通过这个命令你可以安装最新的 wxPython4 版本。如果您使用的是 Windows 或 macOS
$ pip install -U wxpython
If you are using Anaconda/Conda
如果您使用的是 Anaconda/Conda
$ conda install -C anaconda wxpython