[英]when using zc.buildout encounter a “UserWarning” about double import pkg_resources
when I run bin/buildout
, the warning repeated like this: 当我运行
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
I use zope's bootstrap.py and before run bin/buildout
, I run python bootstrap.py --distribute
我使用zope的bootstrap.py并在运行
bin/buildout
之前运行python bootstrap.py --distribute
in bootstrap.py, pkg_resources
is imported, and in bin/buildout parts/buildout
is prepended to sys.path 在bootstrap.py中,
pkg_resources
被导入,而在bin / buildout parts/buildout
被添加到sys.path
sys.path[0:0] = [
'/Users/healdream/Playground/python/buildout/parts/buildout',
]
in parts/buildout/site.py:262, pkg_resources is explicitly imported again import pkg_resources
. 在parts / buildout / site.py:262中,再次显式
import pkg_resources
再次import pkg_resources
。 so the warning appears. 因此出现警告。
how to avoid the warning? 如何避免警告?
It was probably a isolation issue which was only addressed by the upgrade because it replaced the base installation. 这可能是一个隔离问题,只能通过升级解决,因为它取代了基本安装。 If it happens again, trying a virtualenv is a good idea:
如果再次发生,尝试使用virtualenv是一个好主意:
$ virtualenv --no-site-packages .
$ bin/python bootstrap.py
$ bin/buildout
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.