我正在尝试在python中使用mayavi可视化点云,但无法解决此错误。我确信这是一个简单的pip安装,但是我不确定该命令。任何帮助深表感谢!谢谢!
顺便说一句,我正在运行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
答案 0 :(得分:2)
此问题的解决方案是使用较旧的软件包。并非所有依赖项(例如traitsui)都与Python 2.7兼容。即使安装了旧版本的mayavi,自动安装的依赖项也不兼容(它们仅支持Python 3)。
以下是适合我的版本:
要安装特定版本,只需运行sudo pip install packageName==#.#.#