当我运行时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
。所以出现警告。
如何避免警告?