Tag Archives: virtualenv

Enable system site packages in virtualenv

I started using virtualenv for all python apps I run (because I hate to make mess with pip in system site-packages). Later I’ve found out that some dependencies can not be installed via pip but are included in standard system packages installed via apt or yum. To use these imports inside your venv, you need to specify parameter –system-site-packages when creating your venv. If you only find out that you really need them later, you can enable them by deleting following file:
your_venv_dir/lib/pythonXXX/no-global-site-packages.txt

Happy pythoning!

Source: https://virtualenv.pypa.io/en/latest/userguide/#the-system-site-packages-option