2017-06-12 79 views
0

我試圖安裝Mayavi的在MacOS(當前運行的塞拉利昂)使用下列內容:在MacOS使用Mayavi的與PyQT5

brew install --with-qt5 vtk 
brew install mayavi 

這理論上應該工作,但現在當我嘗試在我的代碼使用Mayavi的我得到的以下錯誤:

Traceback (most recent call last): 
    File "test.py", line 32, in <module> 
    mlab.figure(1, bgcolor=(1, 1, 1), fgcolor=(0, 0, 0), size=(400, 300)) 
    File "/usr/local/lib/python2.7/site-packages/mayavi/tools/figure.py", line 63, in figure 
    engine = get_engine() 
    File "/usr/local/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 101, in get_engine 
    return self.new_engine() 
    File "/usr/local/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 146, in new_engine 
    check_backend() 
    File "/usr/local/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 49, in check_backend 
    ''') 
ImportError: Could not import backend for traits 
_______________________________________________________________________________ 

Make sure that you have either the TraitsBackendWx or the TraitsBackendQt 
projects installed. If you installed Mayavi with easy_install, try 
easy_install <pkg_name>. easy_install Mayavi[app] will also work. 

If you performed a source checkout, be sure to run 'python setup.py install' 
in Traits, TraitsGUI, and the Traits backend of your choice. 

Also make sure that either wxPython or PyQT is installed. wxPython: 
http://www.wxpython.org/ PyQT: 
http://www.riverbankcomputing.co.uk/software/pyqt/intro 

我相信錯誤在於,自制只支持QT5和PyQT5而編寫Mayavi在後臺尋找PyQt4的事實。有沒有辦法讓Mayavi與PyQT5一起工作,或者有沒有辦法用brew來安裝PyQT4?

當然,這個問題可能在其他地方....

謝謝!

+0

另一種方法是用wx代替qt - > http://docs.enthought.com/mayavi/mayavi/installation.html並設置環境變量'export ETS_TOOLKIT = wx'這是值得一試的 –

+0

哇。 ..所以通過'brew'安裝wxPython似乎已經解決了這個問題。我認爲mayavi會自動查找任何支持的後端。如果你想讓你的評論成爲答案,我會接受它。謝謝! – nalyd88

回答