1. .venv 폴더 생성

cd 프로젝트 디렉토리명
python -m venv .venv


2. 패키지 한번에 다운
(선택사항 : requirements.txt가 존재하면)

pip install -r requirements.txt


3. 가상환경 활성화

cd .venv/Scripts
activate

 

4. .gitignore에 .venv 추가

(선택사항이지만 추천)

 



* requirements.txt 쓰는 이유
현재 pip로 설치된 패키지들을 requirements.txt에 저장해 다른 사람이 이 프로젝트를 사용할 때 쉽게 패키지를 다운 받을 수 있게 함.

* requirements.txt 생성하는 법

cd 프로젝트 디렉토리명
pip freeze > requirements.txt

 

 

728x90

+ Recent posts