bin/python bootstrap.py -d 期间如何解决pkg_resources.VersionConflict错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17586987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 08:36:59  来源:igfitidea点击:

How to solve pkg_resources.VersionConflict error during bin/python bootstrap.py -d

pythonsetuptoolsbuildout

提问by Python Team

I am tring to create a new plone environment using python plone-devstart.py tool. I got a bootstrap error. So i used a command bin/python bootstrap.py -d from my project directory. It(bin/python bootstrap.py -d command) worked fine before But now i got an error like

我正在尝试使用 python plone-devstart.py 工具创建一个新的 plone 环境。我收到引导错误。所以我从我的项目目录中使用了命令 bin/python bootstrap.py -d 。它(bin/python bootstrap.py -d 命令)之前工作正常但现在我得到了一个错误

oomsys@oomsysmob-6:~/demobrun$ bin/python bootstrap.py -d
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-  
0.6.49.tar.gz
Extracting in /tmp/tmpDqVwYA
Now working in /tmp/tmpDqVwYA/distribute-0.6.49
Building a Distribute egg in /tmp/tmpv4Bzyv
/tmp/tmpv4Bzyv/distribute-0.6.49-py2.7.egg
Traceback (most recent call last):
File "bootstrap.py", line 118, in <module>
ws.require('zc.buildout' + VERSION)
File "build/bdist.linux-i686/egg/pkg_resources.py", line 698, in require
File "build/bdist.linux-i686/egg/pkg_resources.py", line 600, in resolve
pkg_resources.VersionConflict: (setuptools 0.6c11 (/home/oomsys/demobrun  
/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg),    
Requirement.parse('setuptools>=0.7'))

采纳答案by Martijn Pieters

You have the distributefork of setuptoolsinstalled in your site packages, but your bootstrap.pyis trying to install buildout2.2.0, which uses the new mergedsetuptools0.7 or newer egg.

您在站点包distributesetuptools安装了fork ,但您bootstrap.py正在尝试安装buildout2.2.0,它使用新合并的setuptools0.7 或更新的蛋。

The distributefork of setuptoolswas merged back into the setuptoolsproject and the transition is causing some pain.

distributeforksetuptools被合并回setuptools项目中,转换造成了一些痛苦。

Your options are:

您的选择是:

Tell bootstrapto use an earlier zc.buildoutversion

告诉bootstrap使用早期zc.buildout版本

Run bootstrap.pywith the -voption, forcing it to stick to a specific, earlier version:

bootstrap.py使用该-v选项运行,强制它坚持使用特定的早期版本:

 $ bin/python bootstrap.py -d -v 2.1.1

Version 2.1.1 of buildout will not upgrade itself to 2.2 or newer and works with your distribute-supplied setuptoolsegg.

buildout 的 2.1.1 版本不会将自身升级到 2.2 或更新版本,并且可以与您distribute提供的setuptools蛋一起使用。

Uninstall the old distributeegg

卸载旧distribute

Manually delete all distribute*, pkg_resources.py*and setuptools*files from your site-packagesdirectory:

从您的目录中手动删除所有distribute*,pkg_resources.py*setuptools*文件site-packages

$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/setuptools*
$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/distribute*
$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/pkg_resources.py*

and (optionally) reinstall setuptoolsfrom with the latest ez_setup.py; the current version is 0.9.6, and the setuptoolsPyPI pagelinks you to this ez_setup.pyversion.

和(可选)setuptools使用最新版本重新安装ez_setup.py;当前版本为 0.9.6,setuptoolsPyPI 页面将您链接到此ez_setup.py版本

You'll also need to upgrade your bootstrap.pyscript, see below.

您还需要升级您的bootstrap.py脚本,请参见下文。

Use a recent virtualenv

使用最近的 virtualenv

Version 1.9 or newer of virtualenv(released March 2013) lets you create a virtualenv without the setuptoolsegg using the --no-setuptoolsswitch:

版本 1.9 或更新版本virtualenv(2013 年 3 月发布)允许您setuptools使用--no-setuptoolsswitch创建一个没有鸡蛋的 virtualenv :

$ virtualenv --no-setuptools buildout_env

Use that to create a virtual env python to run your bootstrap.py. You still need to upgrade your bootstrap.pytoo. See below.

使用它来创建一个虚拟 env python 来运行你的bootstrap.py. 你仍然需要升级你的bootstrap.py。见下文。

Upgrade your bootstrap.py.

升级您的bootstrap.py.

For zc.buildoutversions 2.2.0 and up the bootstrap.pyscript has been updated to load setuptoolsthe-not-forked-version. Grab a new copy at from github (link to the 2 branch version), replace your old bootstrap.pywith it, and bootstrap again.

对于zc.buildout2.2.0 及更高版本,bootstrap.py脚本已更新以加载setuptools非分叉版本。从 github (link to the 2 branch version) 获取一个新副本,bootstrap.py用它替换旧的,然后再次引导。

Do make sure you removed the old forked really-distribute-but-pretending-to-be-setuptoolsegg first or run with a virtual env python that does not have that egg. See above.

请确保您确实删除了旧的分叉distribute- 但首先假装成为setuptools鸡蛋,或者使用没有那个鸡蛋的虚拟 env python 运行。看上面。