본문 바로가기

프로그래밍/Python

[요약] 파이썬(Python) 개발환경 설정 - Windows

[요약] 파이썬(Python) 개발환경 설정 - Windows

          설치 버전은 항상 "Stable Release" 버전을 다운로드하고 설치할 것을 권장.


1. Python 설치

   최신버전 다운로드(작성시점, 2020-08-31, 3.7.9) : https://www.python.org/downloads/

  * 주의

      설치 경로에 한글이 들어가지 않도록 할것.

      설치시 환경설정 Path가 자동 지정되도록 체크

           


2. Visual Studio Code 설치 : 파이썬 개발을 위한 통합IDE (이클립스 대체 가능)

  최신버전 다운로드 및 설치 : https://code.visualstudio.com

  * 주의

      불편하더라도 영문 버전으로 사용하는 것이 미래를 위해서 효과적임

      설치시 환경설정 Path가 자동 지정되도록 체크


3. 파이썬 설치 확인

cmd  명령창 오픈

C:\Users\Administrator>python

Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>>  이렇게 나오면 정상 설치 됨.

>>>

>>>

>>> exit()


4. Visual Studio Code 개발환경 설정


  • 확장(Extention) 설치 : Python


  • 작업폴더 지정 : File>Open Folder를 열어서 작업할 폴더를 지정
  • Command Palette 설정 : View>Command Palette 선택 (Ctrl + Shsift + P), 
  • Python으로 검색하여 Python: Select Interpreter 선택
  • task.json 파일 설정
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version""2.0.0",
    "tasks": [
        {
            "label""Project Label",
            "type""shell",
            "command""python",
            "args": [
                "${file}"
            ],
            "presentation": {
                "reveal""always",
                "panel""new"
            },
            "options": {
                "env": {
                    "PYTHONIOENCODING""UTF-8"
                }
            },
            "group": {
                "kind""build",
                "isDefault"true
            }
        }
    ]
}