开发者

Python Virtualenv

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 us开发者_开发问答e them in my virtual project environment?


You can also (on UNIX) symlink specific packages from the Python site-packages into your virtualenv's site-packages.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜