preprocessing

파이썬 가상환경 설치

hayleyhell 2023. 1. 31. 09:28

https://docs.python.org/3/tutorial/venv.html 

 

12. Virtual Environments and Packages

Introduction: Python applications will often use packages and modules that don’t come as part of the standard library. Applications will sometimes need a specific version of a library, because the ...

docs.python.org

 

 

1. 비주얼 스튜디오에서 새 터미널 열기 

터미널에서 위의 명령어를 실행하면

hayley라는 가상환경이 생긴다.

 

가상 환경 들어가는 방법 

1. 가상 환경을 생성한 Script 폴더로 이동한다.

 

2. activate 명령어를 입력한다. 

 

activate 시 PowerShell에서 파이썬을 실행한 경우 다음과 같은 문제가 발생할 수 있다. 

비주얼 스튜디오 코드는 기본 터미널이 파워셀로 설정되어 있기 때문에 발생한 문제이다. 

 

해결 방법 

ctrl + shift + p를 누르고 terminal select default까지만 치면 아래와 같이 검색 결과가 나온다. 

해당 기능을 선택하고 Command Prompt를 선택한다. 

 

프로그램을 종료하고 다시 activate를 실행하면 hayley 라는 가상환경이 만들어졌다.