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'
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With