[Python]AttributeError: module ‘inspect‘ has no attribute ‘getargspec‘. Did you mean: ‘getargs‘解决方法

解决方法

最近在做MANO手部模型的时候,遇到了个问题:

在Pycharm用pip安装inspect模块后,运行代码会报错 AttributeError: module ‘inspect’ has no attribute ‘getargspec’. Did you mean: ‘getargs’?*

原因似乎是因为python版本过高,目前github上也有人提出了这个问题,但作者还没有对该问题进行修改。
在经过一番搜寻后,找到一个解决方法:https://github.com/pyinvoke/invoke/issues/833

即在用到inspect这个包的代码里加上以下内容,这样就不会再报错了,也不会影响正常使用:
在这里插入图片描述

import inspect

if not hasattr(inspect, 'getargspec'):
    inspect.getargspec = inspect.getfullargspec

from invoke import task

(PS:可能还需要pip install invoke一下)

猜你喜欢

转载自blog.csdn.net/Bartender_VA11/article/details/134741939
今日推荐