Sunday, April 04, 2010

Using pip, virtualenv, and virtualenvwrapper in Cygwin

I have been using pip, virtualenv, and virtualenvwrapper in Cygwin for long time, it is pretty handy to isolate my development environment for each python projects I am working on. But I still need to think about what need to be done to setup all the pip, virtualenv, and virtualenvwrapper on Cygwin. To save my time and help anybody would like to setup the stuff on Cygwin, I recorded the process as following:
  • Use Cygwin setup to install Python for Cygwin.
  • Install easy_install in your Cygwin: download and run ez_setup.py in Cygwin.
  • Install pip by using easy_install: eazy_install pip.
  • pip install virtualenv
  • pip install virtualenvwrapper
  • add the following lines into your ~/.bashrc
    • export WORKON_HOME=/cygdrive/c/labs/virtualenvs
      source /usr/bin/virtualenvwrapper_bashrc
That is all, now you can create a new virtualenv in your Cygwin: mkvirtualenv my-first-env. You can use pip to install the specific packages you need for your virtualenv. To activate your virtualenv: workon my-first-env. To deactivate your virtualenv: deactivate. To remove the virtualenv: rmvirtualenv my-first-env.

No comments: