When creating a virtual environment with no -site packages do I need to install mysql & the mysqldb adapter which is in my global site packages in order to use them in my virtual project environment?
Asked
Active
Viewed 944 times
2 Answers
5
You can also (on UNIX) symlink specific packages from the Python site-packages into your virtualenv's site-packages.

Adam Vandenberg
- 19,991
- 9
- 54
- 56
-
+1, I was trying to capture the symlinks from my virtual env so that I could put it here. When, I came back you had already answered it. – pyfunc Nov 25 '10 at 04:57
0
Yes. you will need to install then exclusively for this virtualenv.
See: http://virtualenv.openplans.org/#the-no-site-packages-option
If you build with virtualenv --no-site-packages ENV it will not inherit any packages from global site package directory.
If you see the files inside the site-packages directory, the packages are made via symlinks.
drwxr-xr-x 3 ashish staff 102 Nov 24 20:52 ..
lrwxr-xr-x 1 ashish staff 85 Nov 24 20:52 UserDict.py -> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/UserDict.py
.....
So you could definitely add packages manually by creating these symlinks for specific package.
Adam Vandenberg correctly answers that.

pyfunc
- 65,343
- 15
- 148
- 136
-
Hey thank you for your help & answer. I can also use pip & or easy_install to install the packages I want also correct? – demet8 Nov 25 '10 at 05:39
-
@demet8: Thanks a lot. I was a bit late in providing the complete answer. Please accept Adam Vandenberg's answer as he beat me to it. – pyfunc Nov 25 '10 at 05:41
-
@Adam Vandenberg: @demet8: Thanks for making the change. It was important. – pyfunc Nov 25 '10 at 22:19