【问题标题】:Error "No module named wxversion" when launching playonlinux启动 playonlinux 时出现错误“没有名为 wxversion 的模块”
【发布时间】:2017-10-05 16:45:41
【问题描述】:

我目前在 GNOME 上并尝试运行 playonlinux,但不幸的是,当我尝试启动它时,我得到了这个:

"Looking for python... 2.7.11 - Traceback (most recent call last):
  File "/usr/share/playonlinux/python/check_python.py", line 1, in <module>
    import os, wxversion
ImportError: **No module named wxversion**
failed tests
Looking for python2.7... 2.7.11 - Traceback (most recent call last):
  File "/usr/share/playonlinux/python/check_python.py", line 1, in <module>
    import os, wxversion
ImportError: **No module named wxversion**
failed tests
Looking for python2.6... 
Looking for python2... 2.7.11 - Traceback (most recent call last):
  File "/usr/share/playonlinux/python/check_python.py", line 1, in <module>
    import os, wxversion
ImportError: **No module named wxversion**
failed tests
Please install python before trying to run this program"

我尝试重新安装 Python 和 Playonlinux,但没有成功。

我已经安装了 python-wxgtk3.0,但是当我用一个小的 python 脚本列出我拥有的所有 python 包时,它没有出现......

我的 Python 版本是 2.7.11。

有人知道我能做什么吗?

谢谢,

拉扬

【问题讨论】:

    标签: python linux wxpython


    【解决方案1】:

    你可以参考这个How to install wxPython

    使用 pip install wxPython-Phoenix (Linux):

    sudo pip install --upgrade --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython 
    

    或者这个SO Post

    【讨论】:

    • 您好,感谢您的回答。我尝试了您发布的命令行(“sudo pip install --upgrade --pre -f wxpython.org/Phoenix/snapshot-builds wxPython”),但我收到一条很大的错误消息。我在这里上传了错误:justpaste.it/errorwxpythonlinux 因为我还没有找到解决方案(如果有人可以帮助我调试这个)。我还尝试了您发布的第一个链接,并且编写的命令基于不再存在的库 url :/ (apt.wxwidgets.org) 关于最后一个链接,它解释了 mac 用户的程序,我实际上是在 linux 上^^ 请问还有什么其他建议吗?谢谢
    【解决方案2】:

    python-wxversion 可作为单独的软件包提供。
    使用synapticapt 安装它。

    sudo apt show python-wxversion
    Package: python-wxversion
    Version: 3.0.2.0+dfsg-1build1
    Priority: optional
    Section: universe/python
    Source: wxpython3.0
    Origin: Ubuntu
    Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
    Original-Maintainer: wxWidgets Maintainers <freewx-maint@lists.alioth.debian.org>
    Bugs: https://bugs.launchpad.net/ubuntu/+filebug
    Installed-Size: 64.5 kB
    Depends: python:any (<< 2.8), python:any (>= 2.7.5-5~)
    Homepage: http://wxpython.org/
    Task: edubuntu-desktop-gnome, ubuntustudio-photography
    Supported: 9m
    Download-Size: 12.7 kB
    APT-Manual-Installed: no
    APT-Sources: http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
    Description: API for selecting the wxPython version to use
     wxWidgets (formerly known as wxWindows) is a class library for C++ providing
     GUI components and other facilities on several popular platforms (and some
     unpopular ones as well).
     .
     This package provides the wxPython version selector.
    

    【讨论】:

    • 您好,感谢您的回答。我实际上已经安装了这个包。但是当python尝试导入对应的包时,却找不到……我用了一个小脚本列出了我拥有的python模块但是wx/wxversion不在列表中。
    • sudo apt list | grep python-wxversion python-wxversion/xenial,xenial,now 3.0.2.0+dfsg-1build1 all [已安装,自动]
    • 运行这个命令行我得到这个:python-wxversion/yakkety,yakkety,now 3.0.2.0+dfsg-3 all [installed]。请问如何安装你写的版本?
    • 我运行“apt-cache madison python-wxversion”来列出它的所有版本,这就是我得到的:python-wxversion | 3.0.2.0+dfsg-3 | ch.archive.ubuntu.com/ubuntu yakkety/universe amd64 包 python-wxversion | 3.0.2.0+dfsg-3 | ch.archive.ubuntu.com/ubuntu yakkety/universe i386 包
    • 在您的盒子上找到wxversion.py,如果您有标准安装,请制作本地副本或确保它在/usr/lib/python2.7/dist-packages 中。 apt 的差异将归结为我们操作系统之间的不同存储库。
    【解决方案3】:

    在最新版本的 wxPython(我写这篇文章时是 4.0.1)中,不推荐使用 wxversion。见https://docs.wxpython.org/MigrationGuide.html#the-wxversion-module

    只需删除 wxversion 导入,或替换为 wx,因为我想它只是在导入之前检查 wxPython 的版本。

    【讨论】:

      猜你喜欢
      • 2015-12-26
      • 2016-11-03
      • 2022-01-12
      • 2023-03-03
      • 1970-01-01
      • 2018-11-03
      • 1970-01-01
      • 1970-01-01
      • 2013-11-10
      相关资源
      最近更新 更多