Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 1.9 KB

setup_python_in_osx.org

File metadata and controls

65 lines (48 loc) · 1.9 KB

You shouldn’t use system python for OSX

  • Using system python for OSX is painful. Here is an article which tells you the reason.

Using Virtual Environments to set up python for OSX

Install pip

  • Download latest version of get-pip.py
  • Run the following:
python get-pip.py

Install virtualenv

pip install virtualenv --user

Install virtualenvwrapper

virtualenvwrapper provides a set of commands which makes working with virtual environments much more pleasant. It also places all your virtual environments in one place.

(full installation instructions)

pip install virtualenvwrapper --user

Set up shell startup file

Add three lines to your shell startup file (.bash_profile, .zshrc)

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source <path-to-your-virtualenvwrapper.sh>

Note: If you cannot find your virtualenvwrapper.sh, use the following command to find it.

find / -name virtualenvwrapper.sh

Create a virtual environment

mkvirtualenv py27

Work on a virtual environment

workon py27

If the virtualenv is activated, your shell should look at this. shell.png

Install python package

Once virtualenv is set up, you can simply use pip install <package-name> to install packages.

references: