Linux系统教程:修复“ImportError: No module named wxversion
问题 我试着在[某某 Linux 发行版]上运行一个 Python 应用,但是我得到了这个错误“ImportError: No module named wxversion.”。我怎样才能解决 Python 程序中的这个错误呢?
<span class="typ">Looking</span><span class="kwd">for</span><span class="pln"> python</span><span class="pun">...</span><span class="lit">2.7</span><span class="pun">.</span><span class="lit">9</span><span class="pun">-</span><span class="typ">Traceback</span><span class="pun">(</span><span class="pln">most recent call </span><span class="kwd">last</span><span class="pun">):</span>
<span class="typ">File</span><span class="str">"/home/dev/playonlinux/python/check_python.py"</span><span class="pun">,</span><span class="pln"> line </span><span class="lit">1</span><span class="pun">,</span><span class="kwd">in</span>
<span class="kwd">import</span><span class="pln"> os</span><span class="pun">,</span><span class="pln"> wxversion</span>
<span class="typ">ImportError</span><span class="pun">:</span><span class="typ">No</span><span class="kwd">module</span><span class="pln"> named wxversion</span>
<span class="pln">failed tests</span>
该错误表明,你的Python应用是基于GUI的,依赖于一个名为wxPython的缺失模块。wxPython是一个用于wxWidgets GUI库的Python扩展模块,普遍被C++程序员用来设计GUI应用。该wxPython扩展允许Python开发者在任何Python应用中方便地设计和整合GUI。
摇解决这个 import 错误,你需要在你的 Linux 上安装 wxPython,如下:
安装wxPython到Debian,Ubuntu或Linux Mint
<span class="pln">$ sudo apt</span><span class="pun">-</span><span class="kwd">get</span><span class="pln"> install python</span><span class="pun">-</span><span class="pln">wxgtk2</span><span class="pun">.</span><span class="lit">8</span>
安装wxPython到Fedora
<span class="pln">$ sudo yum install wxPython</span>
安装wxPython到CentOS/RHEL
wxPython可以在CentOS/RHEL的EPEL仓库中获取到,而基本仓库中则没有。因此,首先要在你的系统中启用EPEL仓库,然后使用yum命令来安装。
<span class="pln">$ sudo yum install wxPython </span>
安装wxPython到Arch Linux
<span class="pln">$ sudo pacman </span><span class="pun">-</span><span class="pln">S wxpython </span>
安装wxPython到Gentoo
<span class="pln">$ emerge wxPython </span>
via: How to fix “ImportError: No module named wxversion” on Linux
相关推荐
以梦为马不负韶华 2020-10-20
YENCSDN 2020-11-17
lsjweiyi 2020-11-17
houmenghu 2020-11-17
Erick 2020-11-17
HeyShHeyou 2020-11-17
lhtzbj 2020-11-17
夜斗不是神 2020-11-17
pythonjw 2020-11-17
dingwun 2020-11-16
lhxxhl 2020-11-16
坚持是一种品质 2020-11-16
染血白衣 2020-11-16
huavhuahua 2020-11-20
meylovezn 2020-11-20
逍遥友 2020-11-20
weiiron 2020-11-16