-
맥북(Macbook pro)에 ipython (readline, QtConsole), numpy, scipy, matplotlib 설치Research Programming 2013. 2. 13. 10:59
# 별다른 요구사항이 없으면 그냥 Anaconda 혹은 EPD package를 받아 설치하는게 정신건강에 좋겠다!
(Anaconda의 경우 python 등등을 별도로 관리하는 디렉토리에 설치하기에 다른 경로로 설치한 것과 중복되지 않는다.)
[설치 후 실행 방법]
ipython qtconsole --pylab
또는, matplotlib의 그래픽을 ipython 화면 내에 표시하려면
ipython qtconsole --pylab=inline
Mac에 실행파일 (혹은 아이콘)을 만드는 방법은 위 명령을 text 파일로 만든 뒤 확장자를 .command로 바꿔서 shell script로 변환. (Mac에 기본설치된 TextEdit로 만들 경우 format에서 make plain text로 바꿔줄 것.) 그리고 터미널에서 chmod 755 filename 으로 실행권한 바꾼 뒤 사용.
--pylab 옵션을 주고 실행하면 numpy, matplotlib이 import(?)된 상태로 python이 실행된다. scipy는 따로 로드해줘야 함.
Within the ordinate Mac OS X 10.8.2, I could use the 'distribute' way that enables the command 'easy_install'; it is replaced to the 'pip' command. (command for python)
There're several programs to help installation: homebrew, macport (command for Mac OS X)
[Mac terminal 명령어]
새 탭 열기(닫기): ctl + T (W)
ls -FGw -a -l
alias ls='ls -FGw'
도움말 보기: brew --help #--help 혹은 -h (-- 뒤에는 full name, - 뒤에는 약어)
[QtConsole을 제외한 기본적인 설치]
- 'terminal'에서 64-bit인지 32-bit인지 확인 (python -c "print '32-bit' if isinstance(int(2**42), long) else '64-bit'")
- 'terminal'에서 python version 확인: python -V
- ipython, readline은 홈페이지에서 설치파일(dmg)이 제공되지 않아 맥북의 '터미널'에서
sudo easy_install ipython
를 통해 설치. - numpy는 홈페이지에서 다운받은 설치파일 이용.
- matplotlib은 pip으로는 안되서
brew tap samueljohn/python
brew install numpy - scipy는
brew install gfortran
pip install scipy
[QtConsole 설치]ref:http://www.lowindata.com/2013/installing-scientific-python-on-mac-os-x/https://github.com/sympy/sympy/wiki/Installing-the-IPython-qtconsole-in-Mac-OS-XQT는 리눅스에서부터 시작된 라이브러리 모음. (윈도우즈에서의 .net framework 처럼.)PyQT는 QT를 파이썬으로 가져온 것.- 애플 앱스토어에서 Xcode 설치 후 실행하여 인증 (도중에 command line tools 필요하다기에 표시된 웹페이지 가서 애플 프로그래머 등록하고 설치), 구글링해서 홈페이지에서 Qt 설치
- homebrew 홈페이지가서 설치.
- pyqt 설치: brew install pyqt (마지막에 나오는 데로 .bash_profile 파일에 path를 더해줄 것. 그렇지 않으면 pyqt 혹은 pyside 없다고 계속 징징 됨. brew info pyqt 로 다시 볼 수 있음.)
- sudo easy_install pip
- sudo pip install pygments
- brew install zmq
- sudo pip install pyzmq
- Finally done! Type ipython qtconsole --pylab=inline
pip=pip installs packages
PyPI = Python Package Index
PyPI에 있는 라이브러리 모듈들을 pip을 통해 설치한다.
[Mac OS X package manager]
macport는 /opt 디렉토리에 설치한 프로그램을 따로 관리함.
homebrew도 비슷하다고.