virtualenv question: include just a few site packages

Gelonida N gelonida at
Thu Oct 9 00:09:50 CEST 2014

virtualenv has the switch
--system-site-packages (including all system site pacgaes)
and the switch
--no-site-packages (to expclude all site packages)

Does anyone know an easy way to include just a few site-packages?
for example (PySide, but not PyQt)

The reason I'm asking is following.
Some site packages  are sometimes raher huge or sometimes refuse to 
compile on certain hosts.

as these packages are already part of the site packages I'd like to 
include them.

You might wonder why I care whether I have more site packages than I 
need. As long as I don't import them,  I shouldn't care about it.
If I really wanted to replace a version I could use pip install -U.

However sometimes I'd like to have a test environment where want to be 
sure, that no module can find certain other modules. so they should not 
be visible.

at the moment I make some experiments with pyinstaller and the module 
pythonqtbindings. and there I'd like to be sure that no PuQt files end 
up in the generated code.

The only idea, that I have so far is to
run virutalanv with --system-side-packages and to manually remove 
modules I don't want or to
run virtualenv without this switch and to manually add links for site 
packages, taht I want. both options don't really feel right for me.

Is there any other way?

More information about the Python-list mailing list