It is a good practice to use virtualenv to setup independent pythoon envirnoment. Especially, there are multi-version of python this machine.
For details check here
Install
Using Pip (>1.3) install$ [sudo] pip install virtualenv
Using
- Create a folder for this env (trying to setup a python2.7 env)
$ mkdir py27env
$ cd py27env - Create virtualenv for python2.7, in my mac the python27 is located at
/usr/bin/python2.7
thus a virtualenv is created with then name (folder)py27env
by python2.7$ virtualenv --python=/usr/bin/python2.7 py27env
- Active the envThen you can see the shell prompt is changed, py27env is added to the shell prompt
$ cd py27env
$ source bin/activate(py27env) C02NF73EG3QD:py27env guyu$
- Leave the env
Run the following script under the envif you want to clean all the env, then you can remove the folder$ deactivate
$ rm -r path/to/env