Python은 Mac, Li눅스, Win도우 등에서 설치가 가능합니다. 그럼 Win도우에서 Python을 설치하는 방법은?
Windows에서 Python 2.x 설치 방법
Linux와 Mac OS에서 Python은 기본적으로 설치되어있습니다.
터미널 창에서 Python 명령만으로 쉽게 실행할 수 있지만 Windows에서는 Python을 따로 설치해주어야 합니다.
파이썬 웹사이트 접속
- www.python.org
파이썬 다운로드
해당 사이트에 들어가서 Quick Links (2.7.8) – Windows Installer 선택하여 python-2.7.8.msi 다운로드 후 실행하여 설치합니다.
특별히 원하는 버전이 있을 때에는 DOWNLOAD – Releases에서 버전별로 설치파일을 다운로드 할 수 있습니다.
설치 완료
Python의 기본 설치 경로는 C:\Python27 설치 완료 후 환경변수를 등록해야 합니다.
윈도우 환경변수 등록
- 내컴퓨터(마우스 오른쪽 버튼 클릭) – 속성(시스템 등록 정보) – 고급 – 환경 변수 클릭
- 시스템 변수 – Path 선택 후 편집 클릭
- 변수 값에 맨 뒤에 C:\Python27;C:\Python27\Scripts; 입력 후, 확인 버튼을 눌러 시스템에 적용
- 변수 값은 각각 ; (세미콜론) 으로 구분
Python의 패키지 설치 방법 - 패키지 관리 도구 설치하기
파이썬 라이브러리 설치에는 easy_install과 pip가 사용된다.
easy_install
easy_install은 아래 링크에서 다운받아 설치하자
설치 후 C:Python27 폴더 아래에 Scripts라는 폴더가 생긴다.
그 다음 easy_install pip 명령으로 pip를 설치해줍니다.
C:\Python27\Scripts\easy_install.exe pip |
pip 명령의 사용법
- pip install packageName 명령 : 최신버전으로 설치
- pip install packageName==0.x.x 명령 : 0.x.x버전으로 설치
- 패키지 설치 경로 : C:\Python27\Lib\site-packages
- pip uninstall packageName 명령 : package 제거
- pip freeze 명령 : 현재 환경에 설치된 package 이름과 버전 목록
easy_install과 pip가 설치 완료된 화면
iPython 설치하기
pip를 이용하여 iPython을 설치해보자.
iPython은 명령창에서 소스 컬러를 지원하고 편리한 도움말을 제공해준다.
가볍고, 편하고, 강력하다.
pip install "ipython[all]" or pip install "ipython[notebook]" |
환경변수 PATH에 C:\Python27\Scripts 추가
iPython 실행 화면
개발환경 만들기
1. 이클립스 + PyDev 플러그인
2. Python 기본 REPL
3. PyCharm
4. iPython + Notebook
The IPython Notebook
The IPython Notebook is a web-based interactive computational environment where you can combine code execution, text, mathematics,
plots and rich media into a single document
- http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/Index.ipynb
iPython Command Example
Examples -------- ipython --matplotlib # enable matplotlib integration ipython --matplotlib=qt # enable matplotlib integration with qt4 backend ipython --log-level=DEBUG # set logging to DEBUG ipython --profile=foo # start with profile foo ipython qtconsole # start the qtconsole GUI application ipython help qtconsole # show the help for the qtconsole subcmd ipython console # start the terminal-based console application ipython help console # show the help for the console subcmd ipython notebook # start the IPython notebook ipython help notebook # show the help for the notebook subcmd ipython profile create foo # create profile foo w/ default config files ipython help profile # show the help for the profile subcmd ipython locate # print the path to the IPython directory ipython locate profile foo # print the path to the directory for profile `foo` ipython nbconvert # convert notebooks to/from other formats |
iPython Notebook Example
Examples -------- ipython notebook # start the notebook ipython notebook --profile=sympy # use the sympy profile ipython notebook --certfile=mycert.pem # use SSL/TLS certificate |
iPython Notebook 실행화면