Backend/Python

Python 파이썬 다운로드 및 기본 세팅 + VS Code 설정

Ayel 2023. 6. 27. 12:31

 

 

파이썬 다운로드

 

https://www.python.org/

 

Welcome to Python.org

The official home of the Python Programming Language

www.python.org

 

 

메인페이지 접속 > 다운로드 >  Python 3.11.4 버전 다운로드

 

 

 

 

3.7 버전의 경우 2023.6.27 글쓴 날 기준으로 서비스가 종료되어

더 이상 사용이 불가하므로

End of support 날짜를 확인하는 것이 좋다

 

 

 

 

사용 환경에 따라 설치(64-bit) 후 setup 파일 실행

 

 

 

 

기본 세팅을 위해 Add python.exe to PATH 체크

Customize installation 으로 설치

 

 

 

 

Option 선택해 설치

 

 

 

 

install Python 3.1 for all users 옵션을 선택해야

컴퓨터의 다른 사용자도 사용 가능함

 

이 경우 Customize install location 경로가 변경되는데

C드라이브의 Program Files의 Python311 폴더에 설치

 

 

 

파이썬 컴파일러 설치 완료

 

 

 


 

 

파이썬 활용을 위해 VS Code 활용

(이클립스와 같이 실행 창을 VS Code로 활용하는 것)

 

 

https://developernew.tistory.com/4

 

VS Code ; Visual Studio Code 프로그램 설치 방법 / 확장팩 추천 & 설치

유용한 플러그인 중 하나인 VS Code(Visual Studio Code)입니다 무료이기 때문에 유용합니다 마이크로소프트에서 개발한 텍스트 에디터로, 2016년 4월 15일에 정식판이 발표되었습니다 범용 코드 에디터

developernew.tistory.com

 

 

 

 

이번에 다운받을 버전은 system installer

환경에 따라 알맞은 것으로 선택

 

 

 

 

기초 세팅을 위해 

Python과 Code Runner 설치

 

 

 

 

파일 다운로드 및 기초 세팅이 끝나면 VS Code 프로그램 실행

 

1. 워크스페이스

dropbox  공유드라이버 내의 Workspace로 세팅

 

2. 새로운 영역 생성

파이썬 프로그램은 .py 확장자로 생성

 

 

 

 

새로운 영역을 생성한 상태로 Python 세팅

Python: Current File > launch.json

 

 

{
    // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
    // 기존 특성에 대한 설명을 보려면 가리킵니다.
    // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File (Integrated Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        },
        {
            "name": "Python: Remote Attach",
            "type": "python",
            "request": "attach",
            "port": 5678,
            "host": "localhost",
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "."
                }
            ]
        },
        {
            "name": "Python: Module",
            "type": "python",
            "request": "launch",
            "module": "enter-your-module-name-here",
            "console": "integratedTerminal"
        },
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "console": "integratedTerminal",
            "args": [
                "runserver",
                "--noreload",
                "--nothreading"
            ],
            "django": true
        },
        {
            "name": "Python: Flask",
            "type": "python",
            "request": "launch",
            "module": "flask",
            "env": {
                "FLASK_APP": "app.py"
            },
            "args": [
                "run",
                "--no-debugger",
                "--no-reload"
            ],
            "jinja": true
        },
        {
            "name": "Python: Current File (External Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "externalTerminal"
        }
    ]
}

 

 

기본 세팅된 코드 대신 위의 세팅으로 코드 저장

 

 

 

 

코드 저장 후 ▷ 실행 및 디버깅 버튼 클릭

 

 

파이썬 사용을 위한 vs code 기본 세팅 완료