1

当我运行时bin/buildout,警告重复如下:

/Users/healdream/Playground/python/buildout/parts/buildout/site.py:262: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py, but /Users/healdream/Playground/python/buildout/eggs/distribute-0.6.19-py2.6.egg is being added to sys.path
  import pkg_resources

我使用 zope 的bootstrap.py并且在运行之前bin/buildout,我运行python bootstrap.py --distribute

在 bootstrap.py 中,pkg_resources被导入,并且在 bin/buildoutparts/buildout中添加到 sys.path

sys.path[0:0] = [
    '/Users/healdream/Playground/python/buildout/parts/buildout',
    ]

在parts/buildout/site.py:262 中,pkg_resources 再次显式导入import pkg_resources。所以出现警告。

如何避免警告?

4

1 回答 1

0

这可能是一个隔离问题,只能通过升级解决,因为它取代了基础安装。如果它再次发生,尝试 virtualenv 是个好主意:

$ virtualenv --no-site-packages .
$ bin/python bootstrap.py
$ bin/buildout
于 2011-08-20T21:53:49.997 回答