나는 분명히 패키지를 설치를 했는데 자꾸 ModuleNotFoundError
가 난다. uninstall하고 다시 install해봐도 같은 에러가 반복적으로 발생했다. 다시 설치하면 "Requirements Satisfied"라고 다 설치되었다고! 메시지가 뜨는데! 왜 자꾸 import가 안될까,,..
virtual environment를 사용하고 있어서 그런가 했지만 해결하고보니 가상환경 때문은 아니었다.
Python module not found even though "Requirement Already satisfied in Pip"
writing some python in OS X, and it's saying several packages I installed with pip "ImportError: no module named requests" When running pip install requests > sudo -H pip install requests
stackoverflow.com
stackoverflow없이 어찌사나~
stackoverflow에서 발견한 해결방법은 간단했다!
import sys
sys.executable
sys 모듈의 executable 함수는 파이썬 실행 파일의 실제 경로를 반환해준다. 그럼 실제 경로를 반환 받은 후,그 경로를 명시해 준 후 패키지를 설치해주면된다!
! C:\\Users\\user\\anaconda3\\python.exe -m pip install your_package_name
설치를 다 하고나니 이런 메시지가 나타난다. 하,,ㅎ
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. selenium 4.0.0 requires urllib3[secure]~=1.26, but you'll have urllib3 1.25.11 which is incompatible.
파이썬,,, 왜 이런걸 꼭 설치를 제대로 한 다음에 알려주는 거지,,,,(?)
어쨌든 이렇게 경로를 명시해준 후, 패키지를 설치하면 오류 없이 잘 import할 수 있다.
'Python' 카테고리의 다른 글
[Python] Iterator과 Generator (0) | 2021.11.27 |
---|---|
[python] 람다 함수 lambda function (0) | 2021.10.11 |
[pythonic code] 리스트값을 출력하는 다양한 방법 enumerate() zip() (0) | 2021.10.11 |
[pythonic code] 리스트 컴프리헨션 list comprehention (0) | 2021.10.11 |
[python] ❗❓ 예외 처리 Exception Handling (0) | 2021.09.21 |
댓글