I explored this topic a bit more. I started with a Techtonik statement. The answer is simple - no one has implemented it. This, however, raises another question - why didn’t anyone implement it? I suspect the answer is because it works. This leads to another question - why does it work?
The reason that everything works without the DLLs folder copied to virtualenv is because
- Python searches
sys.path to find whatever DLL it needs. sys.path after virtualenv activation contains the path to the source sys.path folder
You can simply test the first statement by removing the path to the DLLs folder from sys.path and trying to import the select module (this module needs the select.pyd file from the DLLs ), which then fails.
In the comment you are saying, I would like to save the Python module DLLs in a virtual environment along with the Python code. This is possible by simply copying the DLLs folder to virtualenv. The reason for this is that sys.path after activating virtualenv, also contains the path to the DLLs folder inside virtualenv (although this folder is not created when creating virtualenv). This path is placed in front of the road into the source DLLs folder, which means that the search is performed first and thus overrides the source DLLs folder.
I sent a question called a DLL folder in Windows to the Python mailing list.
Piotr dobrogost
source share