我正在尝试在python的蜘蛛环境中加载软件包enthought.maya .mlab:
import enthought.mayavi.mlab as mlb
,我得到以下错误信息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:Python27libsite-packagesspyderlibwidgetsexternalshellsitecustomize.py", line 487, in runfile
execfile(filename, namespace)
File "C:UsersEytanDesktopMahPyBrainTraining.py", line 2, in <module>
import enthought.mayavi.mlab as mlb
File "C:Python27libsite-packagesenthoughtmayavimlab.py", line 3, in <module>
from mayavi.mlab import *
File "C:Python27libsite-packagesmayavimlab.py", line 27, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "C:Python27libsite-packagesmayavitoolscamera.py", line 25, in <module>
from engine_manager import get_engine
File "C:Python27libsite-packagesmayavitoolsengine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "C:Python27libsite-packagesmayavipreferencesapi.py", line 4, in <module>
from preference_manager import preference_manager
File "C:Python27libsite-packagesmayavipreferencespreference_manager.py", line 29, in <module>
from traitsui.api import View, Group, Item
File "C:Python27libsite-packagestraitsuiapi.py", line 35, in <module>
from .editors.api import (ArrayEditor, BooleanEditor, ButtonEditor,
File "C:Python27libsite-packagestraitsuieditors__init__.py", line 22, in <module>
from .api import (toolkit, ArrayEditor, BooleanEditor, ButtonEditor,
File "C:Python27libsite-packagestraitsuieditorsapi.py", line 10, in <module>
from .code_editor import CodeEditor
File "C:Python27libsite-packagestraitsuieditorscode_editor.py", line 36, in <module>
class ToolkitEditorFactory ( EditorFactory ):
File "C:Python27libsite-packagestraitsuieditorscode_editor.py", line 48, in ToolkitEditorFactory
mark_color = Color( 0xECE9D8 )
File "C:Python27libsite-packagestraitstraits.py", line 487, in __call__
return self.maker_function( *args, **metadata )
File "C:Python27libsite-packagestraitstraits.py", line 1183, in Color
return ColorTrait( *args, **metadata )
File "C:Python27libsite-packagestraitsuitoolkit_traits.py", line 7, in ColorTrait
return toolkit().color_trait( *args, **traits )
File "C:Python27libsite-packagestraitsuitoolkit.py", line 109, in toolkit
_toolkit = _import_toolkit(ETSConfig.toolkit)
File "C:Python27libsite-packagestraitsuitoolkit.py", line 51, in _import_toolkit
return __import__( name, globals=globals(), level=1 ).toolkit
File "C:Python27libsite-packagestraitsuiqt4__init__.py", line 18, in <module>
import pyface.qt
File "C:Python27libsite-packagespyfaceqt__init__.py", line 35, in <module>
prepare_pyqt4()
File "C:Python27libsite-packagespyfaceqt__init__.py", line 17, in prepare_pyqt4
sip.setapi('QString', 2)
ValueError: API 'QString' has already been set to version 1
有人知道怎么修理它吗?编辑:如果有帮助的话,我认为这个问题已经在最后一栏中解释了:
ValueError: API 'QString' has already been set to version 1
编辑:我试着改变API选择的QString和QVariant对象API #1,#2。没有帮助。尝试将"忽略API更改错误"设置为true,但没有帮助。尝试EST_TOOLKIT从'qt4'到'wx'.
这可能是因为spider本身使用QT库并且已经初始化了它。根据这个http://pythonhosted.org/spyder/installation.html你可以使用PySide而不是PyQt4(但我不知道这是一个配置选项还是一个回退)。