[파이썬 에러] `np.complex` was a deprecated alias for the builtin `complex`

2025. 4. 8. 12:42·에러 해결 모음집
728x90
반응형

에러 코드

AttributeError: module 'numpy' has no attribute 'complex'.
`np.complex` was a deprecated alias for the builtin `complex`. 
To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. 
If you specifically wanted the numpy scalar type, use `np.complex128` here.
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부터 np.complex는 deprecated 되었고, 1,24 부터는 완전히 제거되어서 사용할 수 없다고 합니다.

 

해결법

1. np.complex128 로 변경해보자.

클래스 이름이 바뀌었으니 코드도 수정해보자.

 

2. pip install numpy==1.19.5 넘파이 버전 변경

코드를 수정하기 어려운 상황이라면 넘파이 버전을 다운그레이드 해보자.

 


 

궁금한 점이 있으시다면 댓글 남겨주세요 ❣️

 

728x90
반응형

'에러 해결 모음집' 카테고리의 다른 글

[파이썬 에러] AttributeError: module 'ffmpeg' has no attribute 'input'  (0) 2025.09.05
[파이썬 에러] Autogluon 설치 오류 해결 pip install autogluon  (0) 2025.06.12
[파이썬 에러] name '_C' is not defined  (0) 2025.02.10
[OpenCV 에러] cv2.imwrite() 검정색 이미지로만 저장되는 현상 해결  (6) 2025.02.05
[파이썬 에러] TypeError: read() got an unexpected keyword argument 'ignoregamma’  (1) 2025.02.05
'에러 해결 모음집' 카테고리의 다른 글
  • [파이썬 에러] AttributeError: module 'ffmpeg' has no attribute 'input'
  • [파이썬 에러] Autogluon 설치 오류 해결 pip install autogluon
  • [파이썬 에러] name '_C' is not defined
  • [OpenCV 에러] cv2.imwrite() 검정색 이미지로만 저장되는 현상 해결
CV 공부하는 대학원생 (석사 2년차)
CV 공부하는 대학원생 (석사 2년차)
  • CV 공부하는 대학원생 (석사 2년차)
    잘 읽은 논문 한 편. 끝입니다.
    CV 공부하는 대학원생 (석사 2년차)
  • 전체
    오늘
    어제
    • 분류 전체보기 (70)
      • 석사과정생연구장려금 (1)
      • 3DGS (3)
      • Dataset Distillation (1)
      • Generative Models (5)
      • On-device AI (3)
      • ML (2)
      • DL (1)
      • Backbone (5)
      • LLM (2)
      • 코딩테스트 (25)
      • 에러 해결 모음집 (14)
      • 오픽 (1)
      • 기타 (6)
  • 링크

  • 인기 글

  • 최근 댓글

  • 최근 글

  • 250x250
    반응형
  • hELLO· Designed By정상우.v4.10.3
CV 공부하는 대학원생 (석사 2년차)
[파이썬 에러] `np.complex` was a deprecated alias for the builtin `complex`
상단으로

티스토리툴바