具有依赖关系的问题— ImportError:无法导入名称getfullargspec
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了具有依赖关系的问题— ImportError:无法导入名称getfullargspec相关的知识,希望对你有一定的参考价值。
我正在尝试在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
解决此问题的方法是使用旧软件包。并非所有依赖项(例如traitsui)都与Python 2.7兼容。即使安装了旧版本的mayavi,自动安装的依赖项也不兼容(它们仅支持Python 3)。
以下是适合我的版本:
mayavi==4.6.2
traitsui==6.1.3
traits==5.2.0
numpy==1.17.4
pyface==6.1.2
要安装特定版本,只需运行sudo pip install packageName==#.#.#
以上是关于具有依赖关系的问题— ImportError:无法导入名称getfullargspec的主要内容,如果未能解决你的问题,请参考以下文章
具有本机依赖关系的 Blazor .NET 6 无法构建为 Docker 映像