Programing Language/Python

[Python] Visual studio 환경설정

Data-SSung 2020. 10. 30. 14:45
반응형

주제: Python file을 생성 후 환경설정


이 글은 나도코딩님의 [파이썬 코딩 무료 강의 (기본편)]을 보고 공부한 내용입니다. 

 

1. work space 만들기

  • 바탕화면 or 자신의 폴더에 작업공간 만들기 
    ex) _Python_workspace
  • visual studio code 프로그램 설치하기
    code.visualstudio.com/
 

Visual Studio Code - Code Editing. Redefined

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications.  Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.

code.visualstudio.com

 

2. Visual studio 실행 후 만들어 놓은 폴더 지정하기

  • 왼쪽 상단에 [File] -> [Open folder] ->  _Python_workspace 선택
  • 작업 공간이 _Python_workspace 으로 변경

 

3. python file 생성하기

  • _Python_workspace 폴더에 새로운 [New File] 누르기
  • 파일명.py 설정하고 Enter

  • 혹시 필요한 tool 설치하기
    • ex) [Extension] -> Python(필요한 tool) 검색 -> 필요한 프로그램 설치 (설치하면 Uninstall 상태가 됨)

 

4. python file 실행을 위한 환경 설정하기

  • 생성한 Python file 생성 후 저장하기
    • Python file 에 Print("아무거나")작성 후 [File] -> [save] 혹은 [Ctrl + S] 파일 저장하기

 

  • Python file 실행하기
    • [Run] -> [Debug with Python]  or [Run with Python] -> [Python] 검색 후 선택 -> 다시  생성한 Python file을 선택 후에 [Run with Python] 하면 터미널 창에서 Print("아무거나") 실행

 

  • [Python file 실행하기] 작업을 Python file 실행할 때마다 하기 번거로우므로 다음 작업을 하기
    • [Run] -> [create a launch.json file.] -> [Python File Debug the curruently active Python file] 누리기
      -> {} launch.json 파일이 생성
    • launch.json 파일 생성 후에 Python file 실행할 때마다 위의 과정을 반복하지 않아도 됨

 

 

 

반응형