AttributeError: module 'numpy' has no attribute 'object'.解决方法

我的NVIDIA显卡的型号是GeForce GTX 1050Ti,安装的cuda是11.2的,cuDnn是8.1的,python是3.8的,numpy是1.24.3的,创建conda环境之后,使用conda install tensorflow-gpu==2.5进行安装,安装成功之后在 .py 文件中运行如下代码:

import tensorflow as tf

报错信息为:

AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

解决方法是将您的numpy版本修复到仍然支持使用 np.object 的最后一个版本1.23.4 pip install numpy==1.23.4

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容