How to make sure buildout doesn't use the already installed packages?

China☆狼群 提交于 2019-12-04 04:38:36

You can tell buildout if you want to use site-pakages or not with one of these two directives: include-site-packages and allowed-eggs-from-site-packages

From buildout documentation:

You can then use include-site-packages = false and exec-sitecustomize = false buildout options to eliminate access to your Python's site packages and not execute its sitecustomize file, if it exists, respectively.

Alternately, you can use the allowed-eggs-from-site-packages buildout option as a glob-aware whitelist of eggs that may come from site-packages. This value defaults to "*", accepting all eggs.

Two ways:

  • Use the latest 1.5.something buildouts: they don't use the system packages by default.

  • Run the bootstrap command with the -s flag: python bootstrap.py -s, which means "no site packages".

one alternative that i did use before buildout 1.5 that come with options for exclude eggs from your system python was

virtualenv

we write a virtualenv custom bootstrap that create the environment, fetch bootstrap.py and put a minimal buildout.cfg, but you can use virtualenv normally:

cd project virtualenv --no-site-packages ./
wget http://...../bootstrap.py 
touch buildout.cfg
source bin/activate
python bootstrap.py
bin/buildout

and voila, your buildout isolated with a virtualenv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!