如何确保构建不使用已安装的软件包?
我正在尝试完全切换到构建 - 但我们的开发环境已经在 /usr/lib/pythonxx/
中安装了很多东西,
我如何确保构建不使用安装在系统已经 - 最终没有 virtualenv ?
例如——如何避免这种行为? :
> cat buildout.cfg
[buildout]
parts = django
[django]
recipe = zc.recipe.egg
eggs = django
interpreter = django
>bin/django
>>> import django
>>> django
<module 'django' from '/usr/lib/python2.6/site-packages/django/__init__.pyc'>
>>>
有没有办法强制构建不使用 /usr/lib/python2.6 中安装的eggs?
I am trying to switch fully to buildout - but our development environment already has lot of stuff installed in /usr/lib/pythonxx/
How can I make sure that buildout doesn't use the libraries installed on the system already - eventually without virtualenv ?
For example - how to avoid this behavior ? :
> cat buildout.cfg
[buildout]
parts = django
[django]
recipe = zc.recipe.egg
eggs = django
interpreter = django
>bin/django
>>> import django
>>> django
<module 'django' from '/usr/lib/python2.6/site-packages/django/__init__.pyc'>
>>>
Is there anyway to force buildout NOT to use the eggs installed in /usr/lib/python2.6 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过以下两个指令之一告诉 buildout 是否要使用 site-pakages:
include-site-packages
和allowed-eggs-from-site-packages
来自构建文档:
You can tell buildout if you want to use site-pakages or not with one of these two directives:
include-site-packages
andallowed-eggs-from-site-packages
From buildout documentation:
有两种方法:
使用最新的 1.5.something 构建:默认情况下它们不使用系统软件包。
使用 -s 标志运行 bootstrap 命令:
python bootstrap.py -s
,这意味着“无站点包”。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".,它带有从系统 python 中排除鸡蛋的选项,
我在 buildout 1.5 之前使用的一种替代方案是virtualenv
我们编写一个 virtualenv 自定义引导程序来创建环境,获取 bootstrap.py 并放置最小的 buildout.cfg,但您可以使用 virtualenv通常:
瞧,你的构建与 virtualenv 隔离
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:
and voila, your buildout isolated with a virtualenv