Reputation: 5941
In windows I'm having trouble installing things such as PIL and MySQL inside my virtualenv for Python 2.7 64-bit. I've downloaded extensions from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/ and installed them globally.
But how can I get them to apply to my virtualenv installation? If I do a re-installation of virtualenv for my project, will it inherit the currently installed PIL and MySQL?
My main error is when I do a pip installed: error: Unable to find vcvarsall.bat Now what I've read is I need Visual Studio to compile such things, and I'm hoping this isn't the only way to get things working.
Upvotes: 0
Views: 401
Reputation: 174662
Create your environment with the --system-site-packages
option. Once you are in the virtual environment, if you try to import a package that isn't installed, it will try to find it in the global site packages and only if it can't find it there will it raise an ImportError
.
This is by far the simplest way to do what you are trying on Windows - short of creating your own build environment - which I can tell you from my experience isn't always guaranteed to work.
If you do go with this approach, make sure you still add the package (and ideally pin it) in your requirements.txt
file. This way if you were to deploy it on another environment, you will not miss any dependencies.
Upvotes: 1