簡體   English   中英

使用zc.buildout時遇到有關雙重導入pkg_resources的“ UserWarning”

[英]when using zc.buildout encounter a “UserWarning” about double import pkg_resources

當我運行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 / buildout parts/buildout被添加到sys.path

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

在parts / buildout / site.py:262中,再次顯式import pkg_resources再次import pkg_resources 因此出現警告。

如何避免警告?

這可能是一個隔離問題,只能通過升級解決,因為它取代了基本安裝。 如果再次發生,嘗試使用virtualenv是一個好主意:

$ virtualenv --no-site-packages .
$ bin/python bootstrap.py
$ bin/buildout

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM