📖Python Setting In VSC (Visual Studio Code)
1. Python Setting
- Ctrl + Shift + p
- Ctrl + Shift + b
- No build task to run found. Configure Build Task
- Create tasks.josn file from template 선택
- Others 선택
- 폴더/.vscode/tasks.json 파일이 생김
- json 파일을 아래와 같이 생성
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { //command는 터미널에서 입력될 커맨드, args는 커맨드와 함께 입력되는 인자 "label": "echo", "type": "shell", "command": "python", "args": [ "${file}" ], "group": { "kind": "build", "isDefault": true }, "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": true, "clear": false } } ] }
- 디버깅은 F5 (원하는줄에 F9 누르면 브레이킹 포인트 가능)
- 실행은 Ctrl + F5
2. 패키지 설치 방법
- 가상환경 설정
- 터미널 (Ctrl + ` 1옆에있는거)
-
python -m venv .venv //python -m venv (디렉토리경로)
- 확인은 .vscode/settings.json 에서 ....../.venv\Scripts\python.exe" 함
- 오류 evn/Scripts/activate.ps1 파일을 로드 할 수 없다 해결
- 원인: Windows에서만 발생, Windows Terminal이 기본으로 Power Shell로 설정되어 있기 때문
- 해결
- Ctrl + Shift + p
- Terminal에서 Select Default Shell 입력
- Command Prompt or Git bash로 선택
- 패키지 설치 (명령어로 이동, 실행)
- 터미널에서 .venv/scripts 폴더로 이동한뒤 activate.bat 실행
- pip install [패키지명]
- deactivate.bat (activate에서 빠져나오는 명령)
'Setting > Python' 카테고리의 다른 글
PyCharm 에서 Github 사용 Using Github with PyCharm (0) | 2020.11.24 |
---|---|
파이참 폰트, 테마 변경 PyCharm Setting (0) | 2020.11.23 |
PyCharm 에서 Python 시작하기 (Getting Started with Python in PyCharm (0) | 2020.11.23 |