본문 바로가기
Flutter/Flutter FAQ

Python 로컬 디렉토리에서 requirements.txt 파일에 따라 pip를 사용하여 패키지를 설치하는 방법은 어떻게 됩니까?, How can I install packages using pip according to the requirements.txt file from a local directory?

by 베타코드 2023. 5. 19.
반응형

질문


여기 문제가 있습니다:

requirements.txt 파일이 다음과 같습니다:

BeautifulSoup==3.2.0
Django==1.3
Fabric==1.2.0
Jinja2==2.5.5
PyYAML==3.09
Pygments==1.4
SQLAlchemy==0.7.1
South==0.7.3
amqplib==0.6.1
anyjson==0.3
...

모든 패키지와 기타 패키지가 포함 된 로컬 아카이브 디렉토리가 있습니다.

새로운 virtualenv를 만들었습니다.

bin/virtualenv testing

활성화하면 로컬 아카이브 디렉토리에서 requirements.txt에 따라 패키지를 설치하려고했습니다.

source bin/activate
pip install -r /path/to/requirements.txt -f file:///path/to/archive/

설치가 제대로되었다는 것을 나타내는 일부 출력이 있습니다:

Downloading/unpacking Fabric==1.2.0 (from -r ../testing/requirements.txt (line 3))
  Running setup.py egg_info for package Fabric
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    warning: no files found matching 'fabfile.py'
Downloading/unpacking South==0.7.3 (from -r ../testing/requirements.txt (line 8))
  Running setup.py egg_info for package South
....

하지만 나중에 확인해보니 패키지가 제대로 설치되지 않았습니다. 패키지를 가져올 수 없으며 가상환경의 site-packages 디렉토리에서 찾을 수 없습니다. 그래서 무엇이 잘못되었을까요?


답변


이것은 모두에게 작동합니다:

pip install -r /path/to/requirements.txt

설명:

-r, --requirement < filename >

주어진 요구 사항 파일에서 설치합니다. 이 옵션은 여러 번 사용할 수 있습니다.

반응형

댓글