wxPython import error

后端 未结 10 1080
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: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
    

提交回复
热议问题