分类: Python/Ruby
2012-10-23 15:17:29
There are already lots of articles telling us why we need virtualenv to provide a separate environment(sandbox), such as different projects may depends on different libraries, or you don't have the write permission to the /path/to/python/site-packages directory.
I'm using pip to install virtualenv, it's pretty easy,
pip install virutalenvthen create an sandbox for my project, with the option --no-site-packages to isolate from main site-packages,
virutalenv --no-site-packages social-mapfinally, i cloned my project directly into social-map. To active this environment,
source social-map/bin/activeif you want to deactive this environment, just type deactive. I don't know how to deactive the envrionment before, what i did was exit the terminator, then open a new one, very silly...
we can check the settings as `which python` etc. If you check the active script in ~/your/env/bin/, you can find this, virtual will change your path, and put the virtualenv's path at the beginning of the path, it will change your terminer's PS1 also.
VIRTUAL_ENV="/Users/pengphy/Codes/virtualenvs/social-map" PATH="$VIRTUAL_ENV/bin:$PATH"