본문 바로가기
프로그래밍 이야기/Python

[TensorFlow 2.8] Import "tensorflow.keras" could not be resolved Pylance(reportMissingImports) 경고 해결하기

by meticulousdev 2022. 4. 4.
반응형

- 컴퓨터: M1 맥북에어

- 아나콘다 버전: conda 4.12.0

- Python 버전: 3.9.7

- TensorFlow 버전: 2.8.0 (기존) > 2.6.0 (변경)

 

    어느 순간부터 tensorflow를 사용하는데 경고가 뜨기 시작했습니다. 정상적으로 설치된 것을 확인했고 코드가 정상적으로 실행되니 그냥 써도  상관은 없지만 신경 쓰여서 해결 방법을 좀 찾아봤습니다. 발생하는 경고는 다음과 같습니다. tensorflow.keras를 통해서 import를 하는 대상들에 대해서 경고를 띄웁니다. (글 작성 시점 2022년 04월 04일)

 

Import "tensorflow.keras.preprocessing.image" could not be resolvedPylance(reportMissingImports)
Import "tensorflow.keras.optimizers" could not be resolvedPylance(reportMissingImports)

 

열심히 stackoverflow를 찾다가 다음 글을 발견했습니다.

 

https://stackoverflow.com/questions/71000250/import-tensorflow-keras-could-not-be-resolved-after-upgrading-to-tensorflow-2

 

Import "tensorflow.keras" could not be resolved after upgrading to TensorFlow 2.8.0

TensorFlow 2.8 was recently released and I installed it as soon as it was out. I really need it for support of higher NumPy versions and a few new features. However, after installing it in my conda

stackoverflow.com

 

단순히 TensorFlow 2.8의 문제라는 것입니다. 네? 설마 하고 코랩에서 동일한 코드를 실행하려고 보니 동일한 현상이 발생합니다.

 

TensorFlow 2.6 버전으로 변경하니 다행히도 더 이상 경고를 띄우지 않았습니다.

 

- 같이 읽으면 좋은 글: [TensorFlow] Apple Silicon (M1) MacBook 에서 TensorFlow 버전 지정하여 설치하기

https://meticulousdev.tistory.com/entry/TensorFlow-Apple-Silicon-M1-MacBook-에서-TensorFlow-버전-지정하여-설치하기

 

[TensorFlow] Apple Silicon (M1) MacBook 에서 TensorFlow 버전 지정하여 설치하기

- 개발 환경: M1 맥북에어 - 아나콘다 버전: conda 4.12.0 - Python 버전: 3.9.7 (급하신 분은 (설치 방법) 정리하면 다음과 같다.만 보시면 됩니다.) Apple Silicon에서 버전을 정하고 TensorFlow를 정상적으로..

meticulousdev.tistory.com

 

긴 글 읽어주셔서 감사합니다. 
글과 관련된 의견은 언제든지 환영입니다.
반응형

댓글