virtualenv not copying the existing python modules

python, virtualenv

Solution

You should create virtual environment using `--system-site-packages` option to access system package.

According to `virtualenv --help`:

--no-site-packages    Don't give access to the global site-packages dir to
                      the virtual environment (default)
--system-site-packages
                      Give access to the global site-packages dir to the
                      virtual environment

Problem

``` python -c 'import pyscopg2' ``` this works fine. Now I create a virtualenv ``` virtualenv venv ``` and activate it ``` source venv/bin/activate ``` and run the following ``` python -c 'import pyscopg2' ``` But it gives error 'ImportError: No module named pyscopg2'

Original source