Last weekend I upgraded my Mac to Mountain Lion. I installed Python 2.7 with PIL and MySQLdb and virtualenv using MacPorts.
When I created and activated a virtual environment with
cd myproject
virtualenv .
. bin/activate
the PIL and MySQLdb modules were unrecognizible in that environment. What I needed was just different Django versions in my virtual environments, but MySQLdb and PIL libraries had to be shared.
After a quick search I found an additional parameter for the creation of virtual environment:
virtualenv --system-site-packages .
With this parameter I could use my global modules within the virtual environment.
When using virtualenvwrapper, check add2virtualenv command to add specified packages:
ReplyDeletehttp://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html#add2virtualenv
The reason for this is that in the latest version of virtualenv the --no-site-packages flag it set by default.
ReplyDeleteGood to know!
ReplyDelete