2

我正在 ubuntu 服务器上安装 python 应用程序。我在 buildout.cfg 中添加了 include-site-packages=false 但它仍然没有忽略 dist-packages。

4

1 回答 1

3

Buildout doesn't know about anything dist-packages, as that's a Debian and Ubuntu specific addition to Python. If buildout doesn't exclude it when you exclude site-packages, then is not the only package to have this 'problem'; virtualenv doesn't know about it either, see Ubuntu + virtualenv = a mess? virtualenv hates dist-packages, wants site-packages.

Feel free to file an issue in the buildout issue tracker to request that dist-packages is included when ignoring site-packages.

Note that on my Debian system however, the dist-packages directory is being excluded.

Buildout normally determines what the site-packages directories are by determining the difference between the following two commands:

PYTHONNOUSERSITE="x" python -c "import sys, os;print repr([os.path.normpath(p) for p in sys.path if p])"

and

python -S -c "import sys, os;print repr([os.path.normpath(p) for p in sys.path if p])"

If the latter still includes the dist-packages directory for you, then I'd classify this as a Ubuntu or Debian bug. On Debian 6.0.5, with zc.buildout 1.5.2 that path is not included.

The dist-packages directory is normally added via the site.py module (which the -S switch above disables). Debian and Ubuntu have patched that module.

于 2012-07-03T21:14:40.450 回答