Python 설치 & 환경세팅

A page showing Hydejack-specific markdown content.

파이썬 3.x 버전 설치하기 (macOS 기준)

  • macOS에는 기본적으로 파이썬 2.x 버전이 설치되어 있지만, 권장하지 않는다. python –version 입력하면 레거시 소프트웨어와의 호환성을 위해 포함되어 있기는 하지만 향후엔 포함하지 않을 것이라는 경고가 뜬다.

  • 파이썬 홈페이지에서 최신 버전을 설치해 준다. python.org 다운로드 링크 본인의 OS를 선택해서 나머지 설치과정을 마무리 해주면 된다.

  • 다 마치고 터미널에 아래와 같이 입력하면 정상적으로 최신버전이 설치되었는지 확인할 수 있다.

    python3 --version
    

인터프리터 : 아나콘다 (Anaconda) 설치

텍스트 에디터 : VSC (Visual Studio Code) 설치

VSC 사용시, Python interpreter 선택

Interpreter language란? https://usemynotes.com/what-is-a-python-interpreter/ IDE: 이러한 작업을 수행하는 공간을 VSC로 선택했다.

venv.에서의 작업 권장 (가상환경 세팅 + 라이브러리 설치)

파이썬 라이브러리 설치

python3 -m pip install [라이브러리명]  

+) 가상환경 권장 이유는? https://github.com/popla0428/practice-python/blob/main/01-why-venv.ipynb

cf. pip version update

WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available. You should consider upgrading via the ‘/Users/mk-mac-326/Desktop/my-box/.venv/bin/python3 -m pip install –upgrade pip’ command.

—————————————————————————————————————————— 아나콘다 설치 (주피터 노트북을 사용하기 위함임) To work with Python in Jupyter Notebooks, you must activate an Anaconda environment in VS Code, or another Python environment in which you’ve installed the Jupyter package. 출처: https://code.visualstudio.com/docs/datascience/jupyter-notebooks

인스톨 https://www.anaconda.com/products/individual#macos 자동으로 anaconda 실행 방지 설정하기 conda config –set auto_activate_base false

참고) conda list (if anaconda is installed and working, this will display a list of installed pkgs and versions) python (runs the Python shell. If anaconda installed and working, will include anaconda) quit() (exist the Python shell) 쥬피터 노트북 열기 You can create a Jupyter Notebook by running the Jupyter: Create New Jupyter Notebook command from the Command Palette (⇧⌘P) or by creating a new .ipynb file in your workspace. 필요한 라이브러리 파이썬 터미널에서 설치 가능 예) python3 -m pip install matplotlib

——————————————————————————————————————————

참고 https://code.visualstudio.com/docs/python/python-tutorial

아나콘다 vs 주피터 https://www.quora.com/What-is-the-difference-between-Anaconda-and-Jupyter


© 2021. All rights reserved.

-------Powered by Hydejack-------

Owned by POPLA0428