在wxPython 4.1.0 ImportError上,PlayOnLinux无法使用:没 ImportError: No Module named wxversion, needs to be wx.version instead

分享于 

12分钟阅读

ubuntu

  繁體

问题:

wxPython的最新版本不支持wxversion模块,

对此有什么建议吗?

环境是ubuntu20.04LTS,pyenv,python3.8.3,python2.7.18,wxpython4.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




*** Could not run GTK+ test program, checking why...

尝试此命令


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升级)上用标准存储库重新安装:

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版本:

https://flathub.org/apps/details/org.phoenicis.playonlinux


答案1:

简短的回答:问题与pyenv相关,确保system在全局配置中是首选:pyenv global system或用shell设置当前pyenv shell system的python版本,如果使用global,你只需设置一次,

简短说明:使用 pyenv global system (2nd) (3rd)... 确保playonlinux找到正确的python;其中(2nd)和(3rd)是已安装解释器的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
  • 确保 /usr/share/playonlinux/bash/find_python 解析为已安装的系统python,你必须确保pyenv global被设置为system作为首选。


    答案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
    
    
    
    

    (从上面的命令中,您可以看到两个与wx相关的软件包-列出了python-wxgtk3.0 python-wxversion)



    IMP  模块  play  版本  导入  Named  
    相关文章