Visual Studio Code, Python 개발환경 구축

1. Visual Studio Code vscode

MS가 배포하는 Electron Framwork 기반 Cross-Flatform Code editing

1.1. 설치

※ Developer Survey Results 2018 : https://insights.stackoverflow.com/survey/2018/

image
image

1.2. 특징

  • Fast, Powerful Editing
    • Linting, multi-cursor editing, parameter hints, and other powerful editing features.
    • Code Navigation and Refactoring
  • Meet IntelliSense.
    • syntax highlighting and autocomplete with IntelliSense, which provides smart completions based on variable types, function definitions, and imported modules.
  • Git commands built-in
  • Extensible and customizable
    • Install extensions to add new languages, themes, debuggers, and to connect to additional services

1.3. Getting Started, Top Extensions

1.4. 추천 Extensions

2. Python 개발환경

1.1. 설치

choco install python -y 
  • Linux : Centos 7
# 2.7.x 버전은 기본 설치 되어 있음 
# yum 패키지에서 3.4 버전밖에 없어 3.6 설치하려면 epel-release 저장소 추가 
sudo yum install -y epel-release

# python, pip 설치 
sudo yum install python36u python36u-pip

# python3, pip3 사용 하기위한 심볼릭 링크 
sudo ln -sf /usr/bin/python3.6 /usr/bin/python3 
sudo ln -sf /usr/bin/pip3.6 /usr/bin/pip3

1.2. PIP 패키지 관리

  • Python으로 작성된 패키지 소프트웨어를 설치/관리하는 패키지 관리 시스템
# flask 모듈 설치 
# 전역으로 설치하는것으로 linux의 경우 sudo권한이 필요하고 windows 10의 경우 Admin Role 필요 
## 권고 하지 않음 
pip install flask

# flask 모듈을 user 공간에 설치 (권고)
pip install flask --user 

# pip 설치된 모듈 보기 
pip freeze 

# pip 패키지 삭제 
pip uninstall flask

1.2.1 virtual 환경

  • 가상환경으로 Python 실행 및 패키지 관리
  • virtual 모듈 설치
    • virtualenv : 일반적으로 많이 사용되는 가상환경 관리 모듈
pip install virtualenv --user 

# linux 의 경우 yum으로도 설치 가능 (3.6 기준)
sudo yum install python36-virtualenv -y 
  • virtual 만들기
# python 3.6 환경의 virtual 환경 만들기 
virtualenv --python=/usr/bin/python3 venv

# 기본 virtual 환경 만들기
virtualenv venv

# Path 가 없어 명령어를 찾지 못할 경우 
python -m virtualenv venv
  • activate virtual
# linux 
source venv/bin/activate

# windows 
venv\Script\Activate
  • deactivate virtual
# linux 
deactivate

# windows
venv\Scripts\deactivate.bat

3. Python 개발환경 - vscode

  • Extensions 설치 : Python, Code Runner
  • Python 실행 - Context Menu (mouse right button)
    • Python : Run Python File in Terminal
      • 전체 파일 터미널 실행
      • virual 환경 지원 : 프로젝트 오픈시
        • vscode 폴더로 열면 해당 폴더를 기준으로 프로젝트로 인식
    • Code Runner : Context Menu의 Run Code (Ctrl+Alt+N)
      • 코드 셀렉션 부분 코드 실행 및 전체 파일 실행
      • virtual 환경 지원 안함

image

  • virtual 환경 선택 : 프로젝트 파일 오픈시 가능
    • Command palette 열기 (F1 or Ctrl+Shirt+p)
    • Python Select Interpreter → 선택

image

image

4. 기타 개발환경

choco install googlechrome -y
choco install 7zip -y
choco install conemu -y
choco install vscode -y
choco install python -y
choco install dotnetcore-sdk -y
choco install d2codingfont -y
choco install git -y
choco install tortoisegit -y
choco install curl -y

choco install fiddler -y
choco install filezilla -y
choco install dbeaver -y
  • ConEmu : cmd 대체 툴

    • ConEmu-Maximus5 is a Windows console emulator with tabs, which represents multiple consoles as one customizable GUI window with various features.
    • https://conemu.github.io/
      choco install conemu
  • MSYS2 : Git 설치 디렉토리에 위치

    • Add PATH : C:\Program Files\Git\usr\bin
      MSYS2 is a software distro and building platform for Windows
      At its core is an independent rewrite of MSYS, based on modern Cygwin 
      (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with native Windows software. 
      It provides a bash shell, Autotools, revision control systems and the like for building native Windows applications using MinGW-w64 toolchains.
  • WSL : Windows Subsystem for Linux

'Dev' 카테고리의 다른 글

OS 커널 관련된 글들..  (0) 2008.09.01
요즘, 단상..  (0) 2006.03.28
Subversion 아직은...  (0) 2004.12.06
공익 광고 ..  (0) 2004.11.29
버전관리툴  (0) 2004.11.24

+ Recent posts