Python:numpy 1.19.4没有名为numpy.testing.decorators的模块

tcomlyy6  于 12个月前  发布在  Python
关注(0)|答案(2)|浏览(146)

我最近更新了我的numpy到1.19.4版本,我的scipy到1.5.4当安装另一个新模块。
我现在得到一个错误消息,它说:

from numpy.testing.decorators import slow #noqa
>>> ModuleNotFoundError: No module named 'numpy.testing.decorators'

我不知道该怎么解决。会不会跟更新有关?
我在Anaconda中使用Spyder

ykejflvf

ykejflvf1#

对于numpy版本,1.19.4装饰器现在位于._private

from numpy.testing._private.decorators import slow

应该工作

v64noz0r

v64noz0r2#

如果在只读库文件中出现此错误,则应更新库版本。
例如,如果你在lib/python3.6/dist-packages/pandas/util/testing.py中的from numpy.testing.decorators import slow上失败,你应该更新pandas版本:

pip3 install -U pandas

相关问题