728x90
반응형
에러 코드
AttributeError: module 'numpy' has no attribute 'int'
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.
Did you mean: 'inf'?
Attribute 에러: numpy 모듈은 int라는 attribute를 가지지 않습니다.
이 aliases는 Numpy 1.2.0 버전에서 더이상 사용되지 않습니다.
더 자세한 내용과 가이드를 원한다면, 위에 링크로 들어가 release 노트를 확인하세요.
당신은 'inf'를 사용하려고 했나요?
원인
넘파이 라이브러리 버전이 바뀌면서 np.int는 더이상 사용할 수 없다는 것이었다.
검색해보니 다들 numpy 버전을 바꾸면 된다고 하는데, 나는 dependency 때문에 쉽사리 바꿀 수가 없는 상황이었다. 😂
해결법
1. pip install numpy==1.23.0 로 numpy 버전을 변경하자.
어, 근데 나는 또 다른 오류가 발생했다. 코딩을 하면 항상 에러 코드 무한의 굴레에 빠지게 된다. 😋
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
혹시 이런 오류를 보게 되었다면, 아래 포스트를 참고하길 바란다.
우리 모두 화이팅.. 😂
넘파이 에러 해결
2. 라이브러리 버전을 바꿀 수 없다면 np.int 를 np.int32 로 바꿔보자.
다른 글들을 보니 np.int32 또는 np.int64로 바꾸라고 하더라.
근데 둘 중 어떤 걸 골라야 할 지 몰라 직접 데이터 사이즈를 체크해봤다.
# numpy 1.23.0
>> a = np.int(1)
>> sys.getsizeof(a)
28
# numpy 1.24.3
>>> a = np.int32(1)
>>> sys.getsizeof(a)
28
>>> b = np.int64(1)
>>> sys.getsizeof(b)
32
뭐... 큰 문제가 없다면 아무거나 써도 되겠지만, 혹시 모를 결과 차이가 있을 수도 있을 것 같아 나는 int32를 썼다.
궁금한 점이 있으시다면 댓글 남겨주세요 ❣️
728x90
반응형
'에러 해결 모음집' 카테고리의 다른 글
[파이썬 에러] No module named 'torchvision.transforms.functional_tensor' (1) | 2024.06.07 |
---|---|
[파이썬 에러] cannot import name 'imresize' from 'scipy.misc' (2) | 2024.05.30 |
[파이썬 에러] gensim 4.3.0 requires FuzzyTM>=0.4.0, which is not installed (3) | 2024.05.30 |
[파이썬 에러] ERROR: Failed building wheel for numpy (1) | 2024.05.30 |
[파이썬 에러] 대상 컴퓨터에서 연결을 거부했으므로 연결하지 못했습니다 (1) | 2024.05.30 |