最新版本的 wxPython 不支持 wxversion 模块。相反,信息以 wx.version 的形式提供。
有什么建议的解决方法吗?谢谢!
我的环境是 Ubuntu 20.04 LTS、pyenv、python 3.8.3、python 2.7.18、wxPython 4.1.0
$ apt-cache policy playonlinux
playonlinux:
Installed: 4.3.4-1ubuntu1
Candidate: 4.3.4-1ubuntu1
Version table:
*** 4.3.4-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu focal/multiverse i386 Packages
100 /var/lib/dpkg/status
$ which playonlinux
/usr/bin/playonlinux
# *** note: i'm using pyenv ***
$ pyenv local 2.7.18
$ which python2
/home/dever/.pyenv/shims/python2
$ python2 -V
Python 2.7.18
$ pyenv local 3.8.3
$ which python3
/home/dever/.pyenv/shims/python3
$ python3 -V
Python 3.8.3
安装的 Python 3.8.3 配置有 wxPython 4.1.0
$ python
Python 3.8.3 (default, Jul 16 2020, 20:35:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> print(wx.version)
<function version at 0x7ff77d3cbd30>
>>> print(wx.version())
4.1.0 gtk3 (phoenix) wxWidgets 3.1.4
>>> quit()
因此,playonlinux 命令失败并出现以下错误:
$ playonlinux
Looking for python... 3.8.3 - skipped
Looking for python2.7... 2.7.18 - 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.18 - 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
注意:对于那些因为 GTK+ 错误而在 Ubuntu 20.04 LTS 上安装 wxPython 的人*** Could not run GTK+ test program, checking why...
试试这个命令(在这里找到:https ://wxpython.org/pages/downloads/ )
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
有关其他上下文,另请参阅:https ://discuss.wxpython.org/t/where-to-obtain-wxversion-py/28752
playonlinux 最初安装如下,但在 Ubuntu 20.04 LTS(我从 19.10 升级)上重新安装了标准存储库:
我正在运行的 playonlinux 版本适用于从此处下载的 Ubuntu 18.04(仿生版本):https ://www.playonlinux.com/en/download.html
For the Bionic version
Type the following commands:
wget -q "http://deb.playonlinux.com/public.gpg" -O- | sudo apt-key add -
sudo wget http://deb.playonlinux.com/playonlinux_bionic.list -O /etc/apt/sources.list.d/playonlinux.list
sudo apt-get update
sudo apt-get install playonlinux
也许 playonlinux 被 flatpak 版本取代了?
查看https://www.playonlinux.com上的 Github 链接会将您带到https://github.com/PhoenicisOrg/,这表明解决方案可能是迁移到 flatpak 版本: