wxPython import error

后端 未结 10 1082
Happy的楠姐
Happy的楠姐 2021-02-05 17:56

I\'m having trouble figuring out an error message in Python.

yesterday, I\'ve installed python using the latest EPD package, and wxPython2.9 using the wxPython2.9-osx-co

相关标签:
10条回答
  • 2021-02-05 18:47

    This happened to me on a Windows x64 installation that did not install wxversion.py in the site-packages directory (c:\Python27\Lib\site-packages by default).

    You can get a copy of wxversion.py from the WX svn repository: http://svn.wxwidgets.org/viewvc/wx/wxPython/trunk/wxversion/wxversion.py?content-type=text%2Fplain&view=co

    0 讨论(0)
  • 2021-02-05 18:51

    I'm using Ubuntu 13.10, Canopy 1.2, and PyCharm 3.0.2. When trying to use matlablib, it always complains "Matplotlib backend_wx and backend_wxagg require wxPython >=2.8".Pretty sure that I'm using wxPython 2.8. Then I tried all the methods described in this page, but neither of them works for me.

    It turns out that it can be solved by modifying matplotlibrc file. There is a line:

    backend : WXAgg

    In fact we can change the backend to whatever we like, and I change it to TKAgg, which works just fine for me.

    0 讨论(0)
  • 2021-02-05 18:53

    I just ran into this myself. One potential cause of this (quite unhelpful) error message is if you installed wx as a single-version installation (INSTALL_MULTIVERSION=0 when running setup.py). In this case, the module wxversion does not get built (or installed) and as such matplotlib incorrectly assumes that all of wx is missing.

    This currently is the default setting in installations by the homebrew version of wxWidgets (wxmac) with the option --python.

    In your case (albeit a year and a half late), you'd need to ensure that wxversion.py exists within /usr/local/lib/wxPython-2.9.1.1/lib/python2.7/site-packages/. If it doesn't, you'd need to recompile wx with the above flag set. Otherwise you just need to set your $PYTHONPATH such that it includes the base site-packages directory, too:

    export WXDIR=/usr/local/lib/wxPython-2.9.1.1/lib/python2.7/site-packages
    export PYTHONPATH=$WXDIR:$WXDIR/wx-2.9.1-osx_cocoa:$WXDIR/wx-2.9.1-osx_cocoa/tools
    
    0 讨论(0)
  • 2021-02-05 18:54

    In Ubuntu 12.04, this problem can be solved by running the command

    sudo apt-get install libjpeg62
    

    I realize this may not be useful here, but I wanted to document it somewhere on teh interwebz so I can find it when I run into this problem again myself which will undoubtedly happen.

    0 讨论(0)
提交回复
热议问题