pip freeze creates some weird path instead of the package version
I am working on developing a python package. I use pip freeze > requirements.txt to add the required package into the requirement.txt file. However, I realized that some of the packages, instead...
stackoverflow.com
기본 pip freeze 명령어
pip freeze > requirements.txt
이렇게 pip freeze를 했을때 버전이 안찍히고 이상한 경로가 찍히는 경우가 있습니다.
direct reference 독스 : https://peps.python.org/pep-0440/#direct-references
PEP 440 – Version Identification and Dependency Specification | peps.python.org
In order to maintain better compatibility with existing versions there are a number of “alternative” syntaxes that MUST be taken into account when parsing versions. These syntaxes MUST be considered when parsing a version, however they should be “nor
peps.python.org
원래는 zip 파일이나 github에서 다이렉트로 땡겨오는 경우 direct reference가 찍히는 기능인 것 같은데... 추측상 다른 패키지의 하위 패키지로 install 된 경우에 이런 이슈가 생기는 것 같기도 합니다. 예를 들어서 pandas를 깔면서 numpy가 딸려온 경우 numpy가 버전이 아니라 저렇게 direct reference로 찍힙니다.
pip 버전 20.1 이상에서 발생한다고 하여 pip install "pip<20.1"로 pip을 다운그레이드 해도 해결이 된다는 얘기가 있네요.
해결법
pip list --format=freeze > requirements.txt
pip list 에 --format=freeze 옵션을 주면 찍히는 리스트를 txt로 내보내기 하는 방법입니다.
'Languages > Python' 카테고리의 다른 글
[set] set에서 삽입시에 벌어지는 key 테이블 리사이징 (0) | 2023.07.12 |
---|---|
[getsizeof] 객체가 차지하는 byte 출력하기? (1) | 2023.07.12 |
[conda] 가상환경 만들기, 삭제하기, list 보기, 주피터 노트북 연결 (0) | 2023.06.28 |
[fstring] fstring으로 숫자 포맷팅하기 (0) | 2023.06.28 |
[heapq] 최소힙, 최대힙 (0) | 2023.06.27 |