Python 환경 설정 복붙하는 법

오부랭이·2022년 6월 22일
0

VSC, Colab 등 서로 다른 프로그램 간의 파이썬 환경을 옮기려면, 다음과 같이 txt파일을 이용하여 손쉽게 끝낼 수 있습니다.

  1. 복사해오려는 환경의 터미널에 다음 명령어를 실행합니다.
$ pip freeze

>>>
absl-py==1.1.0
alabaster==0.7.12
albumentations==0.1.12
altair==4.2.0
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arviz==0.12.1
astor==0.8.1
astropy==4.3.1
astunparse==1.6.3
atari-py==0.2.9
atomicwrites==1.4.0
attrs==21.4.0
audioread==2.1.9
autograd==1.4
Babel==2.10.2
backcall==0.2.0
...
  1. requirements.txt를 생성한 뒤 출력된 라이브러리를 복붙합니다.
  • 혹은 $ pip freeze >> requirements.txt 명령어를 사용하여 기본 디렉토리에 바로 생성할 수도 있습니다.
  1. 여러분의 가상환경이 설치된 터미널에 다음 명령어를 입력 및 실행합니다.
$ pip install -r requirements.txt
# or
conda install requirements.txt


다음과 같이 설치된 것을 확인할 수 있습니다.

profile
설명충은 이기적이므로

0개의 댓글