XCode
- install Xcode from the Apple Appstore
- open Xcode, open the preferences, and check the downloads tab to install the latest version of the command line tools.
MacPorts
- Install MacPorts for Lion from the DMG disk image at (http://www.macports.org/install.php)
- Rename .profile to .bash_profile, or if you already have a .bash_profile,
edit this file to make sure that the Macports setup correctly installed the path statement
- Configure Spotlight to exclude /opt/local from indexing: system prefs -> spotlight -> privacy -> add /opt/local
Python27
$ sudo port selfupdate
$ sudo port install python27
### $ sudo port select -–set python python27
$ sudo port install py27-virtualenv
Virtualenv
$ /opt/local/bin/virtualenv-2.7 $HOME/local/python/27
Add to .bash_profile:
alias py27="source $HOME/local/python/27/bin/activate"
$ py27
$ which pip
$HOME/local/python/27/bin/pip
$ pip install ipython
$ which easy_install
$HOME/local/python/27/bin/easy_install
$ easy_install readline
...
Usefull environment variables
export PIP_RESPECT_VIRTUALENV=true
export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
...