반응형
1. requirements.txt
현재 가상환경에 설치된 python 패키지를 버전과 함께 작성하여 requirements.txt 파일에 저장한다
2. requiremnets.txt 생성 커맨드
다음 커맨드를 이용하여 자동으로 requirements.txt파일을 생성할 수 있다.
pip freeze > requirements.txt
* 가끔 다음과 같이 @ file 형식으로 버전이 저장되는 경우가 있다.
aioredis @ file:///home/conda/feedstock_root/build_artifacts/aioredis_1591809643295/work
amqp @ file:///home/conda/feedstock_root/build_artifacts/amqp_1591005859311/work
이는 다음과 같은 커맨드로 해결 할 수 있다
pip list --format=freeze > requirements.txt
3. requiremnets.txt 이용 패키지 설치 커맨드
pip install -r requirements.txt
4. 설치가 되지않는 패키지는 뛰어넘고, 설치가능한 패키지만 모두 설치하기(linux, centos)
cat requirements.txt | xargs -n 1 pip install
반응형