我的NVIDIA顯卡的型號(hào)是GeForce GTX 1050Ti射富,安裝的cuda是11.2的矢门,cuDnn是8.1的盆色,python是3.8的,numpy是1.24.3的祟剔,創(chuàng)建conda環(huán)境之后隔躲,使用conda install tensorflow-gpu==2.5進(jìn)行安裝,安裝成功之后在 .py 文件中運(yùn)行如下代碼:
import tensorflow as tf
報(bào)錯(cuò)信息為:
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版本修復(fù)到仍然支持使用 np.object 的最后一個(gè)版本1.23.4 pip install numpy==1.23.4