본문 바로가기
파이썬 에러

AttributeError: module 'numpy' has no attribute 'object'.

by 나는야석사 2024. 1. 3.
from tensorflow.keras import *

에서 오류 발생.

 

오류 메세지

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 1.20.0 Release Notes — NumPy v2.0.dev0 Manual

NumPy 1.20.0 Release Notes This NumPy release is the largest so made to date, some 684 PRs contributed by 184 people have been merged. See the list of highlights below for more details. The Python versions supported for this release are 3.7-3.9, support fo

numpy.org

 

numpy 버전이 맞지 않아 발생하는 오류로, conda 혹은 pip 중 설치할 때 사용한 명령어로 다른 버전의 numpy를 설치해준다. 구글링하여 Stack overflow를 보다보니, numpy 1.24버전부터 np.object가 사용되지 않는다고 한다.

1.24 하위 버전이면 되는 것 같다.

 

해결방법

conda install numpy==1.23.5 -y

 

오류 해결!