最新版本的 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
注意:对于那些在 Ubuntu 20.04 LTS 上安装 wxPython 遇到困难的人由于 GTK+ 错误*** 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(Bionic 版本):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 版本取代了?
查看 Github 链接https://www.playonlinux.com带你到https://github.com/PhoenicisOrg/这表明也许解决方案是迁移到 flatpak 版本:
答案1
简短回答:问题与以下方面有关:pyenv,请确保system
全局配置中是首选:pyenv global system
或者使用 为当前 shell 设置 python 版本pyenv shell system
。如果使用,global
则只需设置一次。
简短解释:用于pyenv global system (2nd) (3rd)...
确保 playonlinux 找到正确的 python;其中 (2nd) 和 (3rd) 是您所安装的解释器的 pyenv 版本号。
详细解释:在阅读了@N0bert 的非常有用的帖子后,我发现我的问题是pyenv 相关。
具体来说,我可以通过使用pyenv global
命令并system
首先执行如下操作来解决我的问题(注意:您执行的命令取决于您安装的 python 版本):
pyenv global system 3.8.3 2.7.18 anaconda3-2019.10
为了进一步调查该问题,我查看了以下文件:
/usr/share/playonlinux/bash/find_python
/usr/share/playonlinux/python/check_python.py
我复制了这些文件,以便更好地理解错误。结果wxversion错误确实具有误导性,真正的问题是找到正确的 python shell 来运行。playonlinux
取决于系统 python。
最初我以为运行pyenv local system
可以解决问题,但是由于 pyenv 的工作方式,事实并非如此。
为了确保/usr/share/playonlinux/bash/find_python
解析为系统安装的python,您必须确保将其pyenv global
设置system
为首选。
非常感谢@N0rbert!!
答案2
您只需从官方存储库安装最新的 PlayOnLinux 4.3.4 即可
sudo add-apt-repository multiverse
sudo apt-get install --reinstall playonlinux=4.3.4-1ubuntu1
它将依赖于 Python 2,因为它旨在。
安装 PlayOnLinux 及其依赖项的完整命令如下:
sudo apt-get install cabextract curl fonts-wine gcc-10-base:i386 \
glib-networking:i386 gsfonts gstreamer1.0-plugins-base:i386 \
gstreamer1.0-plugins-good:i386 gstreamer1.0-x:i386 i965-va-driver:i386 \
icoutils imagemagick imagemagick-6-common imagemagick-6.q16 \
intel-media-va-driver:i386 jq libaa1:i386 libaom0:i386 libasn1-8-heimdal:i386 \
libasound2:i386 libasound2-plugins:i386 libasyncns0:i386 libatomic1:i386 \
libavahi-client3:i386 libavahi-common-data:i386 libavahi-common3:i386 \
libavc1394-0:i386 libavcodec58:i386 libavutil56:i386 libblkid1:i386 \
libbrotli1:i386 libbsd0:i386 libbz2-1.0:i386 libc6:i386 libcaca0:i386 \
libcairo-gobject2:i386 libcairo2:i386 libcap2:i386 libcapi20-3:i386 \
libcdparanoia0:i386 libcodec2-0.9:i386 libcom-err2:i386 libcrypt1:i386 \
libcups2:i386 libcurl3-gnutls:i386 libdatrie1:i386 libdb5.3:i386 libdbus-1-3:i386 \
libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 \
libdrm2:i386 libdv4:i386 libedit2:i386 libelf1:i386 libexif12:i386 \
libexpat1:i386 libfaudio0:i386 libffi7:i386 libflac8:i386 libfontconfig1:i386 \
libfreetype6:i386 libfribidi0:i386 libgcc-s1:i386 libgcrypt20:i386 \
libgd3:i386 libgdbm-compat4:i386 libgdbm6:i386 libgdk-pixbuf2.0-0:i386 \
libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386 libglib2.0-0:i386 \
libglu1-mesa:i386 libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libgmp10:i386 \
libgnutls30:i386 libgomp1:i386 libgpg-error-l10n libgpg-error0:i386 \
libgphoto2-6:i386 libgphoto2-port12:i386 libgpm2:i386 libgraphite2-3:i386 \
libgsm1:i386 libgssapi-krb5-2:i386 libgssapi3-heimdal:i386 \
libgstreamer-plugins-base1.0-0:i386 libgstreamer-plugins-good1.0-0:i386 \
libgstreamer1.0-0:i386 libgudev-1.0-0:i386 libharfbuzz0b:i386 \
libhcrypto4-heimdal:i386 libheimbase1-heimdal:i386 libheimntlm0-heimdal:i386 \
libhogweed5:i386 libhx509-5-heimdal:i386 libicu66:i386 libidn2-0:i386 \
libiec61883-0:i386 libieee1284-3:i386 libigdgmm11:i386 libilmbase24 \
libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386 \
libjq1 libk5crypto3:i386 libkeyutils1:i386 libkrb5-26-heimdal:i386 \
libkrb5-3:i386 libkrb5support0:i386 liblcms2-2:i386 libldap-2.4-2:i386 \
libllvm10:i386 liblqr-1-0 libltdl7:i386 liblz4-1:i386 liblzma5:i386 \
libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra libmagickwand-6.q16-6 \
libmount1:i386 libmp3lame0:i386 libmpg123-0:i386 libmysqlclient21:i386 \
libncurses6:i386 libncursesw6:i386 libnetpbm10 libnettle7:i386 \
libnghttp2-14:i386 libnuma1:i386 libodbc1:i386 libogg0:i386 libonig5 \
libopenal1:i386 libopenexr24 libopenjp2-7:i386 libopus0:i386 liborc-0.4-0:i386 \
libosmesa6:i386 libp11-kit0:i386 libpango-1.0-0:i386 libpangocairo-1.0-0:i386 \
libpangoft2-1.0-0:i386 libpcap0.8:i386 libpci3:i386 libpciaccess0:i386 \
libpcre2-8-0:i386 libpcre3:i386 libperl5.30:i386 libpixman-1-0:i386 \
libpng16-16:i386 libproxy1v5:i386 libpsl5:i386 libpulse0:i386 \
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libraw1394-11:i386 \
libroken18-heimdal:i386 librsvg2-2:i386 librsvg2-common:i386 librtmp1:i386 \
libsamplerate0:i386 libsane:i386 libsasl2-2:i386 libsasl2-modules:i386 \
libsasl2-modules-db:i386 libsdl2-2.0-0:i386 libselinux1:i386 libsensors5:i386 \
libshine3:i386 libshout3:i386 libslang2:i386 libsnappy1v5:i386 \
libsndfile1:i386 libsndio7.0:i386 libsnmp35:i386 libsoup2.4-1:i386 \
libsoxr0:i386 libspeex1:i386 libsqlite3-0:i386 libssh-4:i386 libssl1.1:i386 \
libstb0:i386 libstdc++6:i386 libswresample3:i386 libsystemd0:i386 \
libtag1v5:i386 libtag1v5-vanilla:i386 libtasn1-6:i386 libthai0:i386 \
libtheora0:i386 libtiff5:i386 libtinfo6:i386 libtwolame0:i386 libudev1:i386 \
libunistring2:i386 libusb-1.0-0:i386 libuuid1:i386 libv4l-0:i386 \
libv4lconvert0:i386 libva-drm2:i386 libva-x11-2:i386 libva2:i386 \
libvdpau1:i386 libvisual-0.4-0:i386 libvkd3d1:i386 libvorbis0a:i386 \
libvorbisenc2:i386 libvpx6:i386 libvulkan1:i386 libwavpack1:i386 \
libwayland-client0:i386 libwayland-cursor0:i386 libwayland-egl1:i386 \
libwebp6:i386 libwebpmux3:i386 libwind0-heimdal:i386 libwine:i386 \
libwrap0:i386 libwxbase3.0-0v5 libwxgtk3.0-gtk3-0v5 libx11-6:i386 \
libx11-xcb1:i386 libx264-155:i386 libx265-179:i386 libxau6:i386 \
libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 \
libxcb-randr0:i386 libxcb-render0:i386 libxcb-shm0:i386 libxcb-sync1:i386 \
libxcb-xfixes0:i386 libxcb1:i386 libxcomposite1:i386 libxcursor1:i386 \
libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 \
libxinerama1:i386 libxkbcommon0:i386 libxml2:i386 libxpm4:i386 \
libxrandr2:i386 libxrender1:i386 libxshmfence1:i386 libxslt1.1:i386 \
libxss1:i386 libxv1:i386 libxvidcore4:i386 libxxf86vm1:i386 libzstd1:i386 \
libzvbi0:i386 mesa-va-drivers:i386 mesa-vdpau-drivers:i386 \
mesa-vulkan-drivers:i386 netpbm ocl-icd-libopencl1:i386 \
playonlinux python-wxgtk3.0 python-wxversion python2 python2-minimal \
python2.7 python2.7-minimal va-driver-all:i386 vdpau-driver-all:i386 \
wine wine32:i386 zlib1g:i386
python-wxgtk3.0 python-wxversion
(从上面的命令中你可以看到列出了两个与 wx 相关的包 - )