2013/03/24

在 Mac OS X 建置 python 開發環境

Install gcc for command line

Open XCode, click menu Preferences -> Downloads
check Command-Line Tools


Install Python-2.7.3

$ tar zxvf Python-2.7.3.tgz
$ cd Python-2.7.3
$ ./configure --prefix=/opt/Python-2.7.3
$ make && make install
$ export PATH=/opt/Python-2.7.3/bin:$PATH


Install distribute-0.6.35

$ tar zxvf distribute-0.6.27.tar.gz
$ cd distribute-0.6.27
$ python setup.py build
$ python setup.py install


Install pip-1.3.1

$ tar zxvf pip-1.1.tar.gz
$ cd pip-1.1
$ python setup.py build
$ python setup.py install


Install virtual environment

$ pip install virtualenv
$ virtualenv --no-site-packages /opt/pyenv
$ export PATH=/opt/pyenv/bin:$PATH



Install eclipse IDE

Download Eclipse Classic 4.2.2

Install PyDev plug-in for eclipse

Click menu Help -> Install New Software
Add repository with location: http://pydev.org/updates, then check the PyDev


Configure the interpreter

Click menu Preferences -> PyDev -> Interpreter - Python
Add new...
 

Add a new project and run it.
The debug mode is powerful.



沒有留言:

張貼留言