numpy 报错:”AttributeError: module ‘numpy‘ has no attribute ‘bool‘“

问题描述

跑代码(pyCUDA,pyTensorRT相关)的时候numpy报错

File ~\anaconda3\envs\myenv\lib\site-packages\numpy_init_.py:284, in getattr(attr)
281 from .testing import Tester
282 return Tester
–> 284 raise AttributeError("module {!r} has no attribute "
285 “{!r}”.format(name, attr))
AttributeError: module ‘numpy’ has no attribute ‘bool’

解决方案

把numpy从1.22.x升级到1.23.1

python -m pip uninstall numpy
python -m pip install numpy==1.23.1

解决方案来源

https://stackoverflow.com/questions/74893742/how-to-solve-attributeerror-module-numpy-has-no-attribute-bool

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_39237205/article/details/129295750
今日推荐