Issue with dependencies -- ImportError: cannot import name getfullargspec
Issue with dependencies -- ImportError: cannot import name getfullargspec
我正在尝试在 python 中使用 mayavi 来可视化点云,但无法解决此错误。我确定这是一个简单的 pip 安装,但我不确定该命令。任何帮助深表感谢!谢谢!
顺便说一句,我是 运行ning Ubuntu 18.04 并已尝试安装 scipy,如此处所述:Python import error "getfullargspec"。我还 运行 pip install traitsui。此外,我已经重新启动了我的系统。
更新:
进一步挖掘后,看来这可能是 Python 版本的问题。我可以使用 Python3 将其设置为 运行,但不能使用 Python 2.7(我需要使用 python 2)。我还尝试将 handler.py 中的代码修改为 getargspec
而不是 getfullargspec
。通过这样做
我得到了关于 trait_factory 的错误
这是完整的打印输出:
Traceback (most recent call last):
File "mayavi_test.py", line 3, in <module>
from mayavi import mlab
File "/home/user/.local/lib/python2.7/site-packages/mayavi/mlab.py", line 16, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/camera.py", line 24, in <module>
from .engine_manager import get_engine
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/api.py", line 4, in <module>
from .preference_manager import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/preference_manager.py", line 29, in <module>
from traitsui.api import View, Group, Item
File "/home/user/.local/lib/python2.7/site-packages/traitsui/api.py", line 37, in <module>
from .editors.api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/__init__.py", line 26, in <module>
from .api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/api.py", line 6, in <module>
from .array_editor import ArrayEditor
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/array_editor.py", line 34, in <module>
from ..view import View
File "/home/user/.local/lib/python2.7/site-packages/traitsui/view.py", line 41, in <module>
from .ui import UI
File "/home/user/.local/lib/python2.7/site-packages/traitsui/ui.py", line 51, in <module>
from .handler import Handler, ViewHandler
File "/home/user/.local/lib/python2.7/site-packages/traitsui/handler.py", line 27, in <module>
from inspect import getfullargspec
ImportError: cannot import name getfullargspec
这个问题的解决方案是使用旧的包。并非所有依赖项(例如 traitsui)都与 Python 2.7 兼容。即使安装了旧版本的 mayavi,自动安装的依赖项也不兼容(它们只支持 Python 3)。
以下是适合我的版本:
要安装特定版本,只需运行 sudo pip install packageName==#.#.#
我正在尝试在 python 中使用 mayavi 来可视化点云,但无法解决此错误。我确定这是一个简单的 pip 安装,但我不确定该命令。任何帮助深表感谢!谢谢!
顺便说一句,我是 运行ning Ubuntu 18.04 并已尝试安装 scipy,如此处所述:Python import error "getfullargspec"。我还 运行 pip install traitsui。此外,我已经重新启动了我的系统。
更新:
进一步挖掘后,看来这可能是 Python 版本的问题。我可以使用 Python3 将其设置为 运行,但不能使用 Python 2.7(我需要使用 python 2)。我还尝试将 handler.py 中的代码修改为 getargspec
而不是 getfullargspec
。通过这样做
这是完整的打印输出:
Traceback (most recent call last):
File "mayavi_test.py", line 3, in <module>
from mayavi import mlab
File "/home/user/.local/lib/python2.7/site-packages/mayavi/mlab.py", line 16, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/camera.py", line 24, in <module>
from .engine_manager import get_engine
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/api.py", line 4, in <module>
from .preference_manager import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/preference_manager.py", line 29, in <module>
from traitsui.api import View, Group, Item
File "/home/user/.local/lib/python2.7/site-packages/traitsui/api.py", line 37, in <module>
from .editors.api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/__init__.py", line 26, in <module>
from .api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/api.py", line 6, in <module>
from .array_editor import ArrayEditor
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/array_editor.py", line 34, in <module>
from ..view import View
File "/home/user/.local/lib/python2.7/site-packages/traitsui/view.py", line 41, in <module>
from .ui import UI
File "/home/user/.local/lib/python2.7/site-packages/traitsui/ui.py", line 51, in <module>
from .handler import Handler, ViewHandler
File "/home/user/.local/lib/python2.7/site-packages/traitsui/handler.py", line 27, in <module>
from inspect import getfullargspec
ImportError: cannot import name getfullargspec
这个问题的解决方案是使用旧的包。并非所有依赖项(例如 traitsui)都与 Python 2.7 兼容。即使安装了旧版本的 mayavi,自动安装的依赖项也不兼容(它们只支持 Python 3)。
以下是适合我的版本:
要安装特定版本,只需运行 sudo pip install packageName==#.#.#