python - 如何确保 buildout 不使用已经安装的包?

标签 python django virtualenv buildout

我正在尝试完全切换到构建 - 但我们的开发环境已经在 /usr/lib/pythonxx/ 中安装了很多东西

我如何确保 buildout 不使用系统上已经安装的库 - 最终没有 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 中的鸡蛋?

最佳答案

您可以通过以下两个指令之一告诉 buildout 是否要使用站点包:include-site-packagesallowed-eggs-from-site-packages

来自扩建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.

关于python - 如何确保 buildout 不使用已经安装的包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4839194/

相关文章:

python - 为什么 python 在 vi​​rtualenv 中看不到 dist-packages?

python - 不要碰我的shebang

python - 将 Pycharm virtualenv 与预先存在的文件一起使用

python - 读取 CSV 文件中的所有列?

python - 如何重定向到 flask 蓝图父级?

python - PyQt5 focusIN/Out 事件

python - cv2.imdecode()从base64中的图像(通过Websocket收到的mimetype image/jpeg)返回None

python - 如何使用 python 请求向 Django REST API 发送 POST 请求

jquery - 如何使用 DJANGO REST 框架和 ajax 发出 POST 请求

django - 我不应该使用 Django 每站点缓存吗?