构建Python项目时Setuptools版本冲突错误

时间:2013-08-14 20:32:57

标签: python setuptools

我正在尝试构建一个python项目,并且我遇到了与setuptools的版本冲突错误。我收到以下错误消息:

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/buildout.py", line 1942, in main
    getattr(buildout, command)(args)
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/buildout.py", line 463, in install
    self._load_extensions()
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/buildout.py", line 998, in _load_extensions
    ep.load()(self)
  File "/Users/raul/PhpstormProjects/clients/ceres/test/ceres/eggs/buildout.eggtractor-0.6-py2.6.egg/buildout/eggtractor/tractor.py", line 68, in install
    part_names = [n for n in buildout['buildout']['tractor-target-parts'].split() if n in buildout]
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/UserDict.py", line 105, in __contains__
    return self.has_key(key)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/UserDict.py", line 100, in has_key
    value = self[key]
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/buildout.py", line 1094, in __getitem__
    options._initialize()
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/buildout.py", line 1198, in _initialize
    self.initialize()
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/buildout.py", line 1204, in initialize
    recipe_class = _install_and_load(reqs, 'zc.buildout', entry, buildout)
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/buildout.py", line 1158, in _install_and_load
    allow_hosts=buildout._allow_hosts
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/easy_install.py", line 812, in install
    return installer.install(specs, working_set)
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/easy_install.py", line 653, in install
    self._maybe_add_setuptools(ws, dist)
  File "/project/eggs/zc.buildout-2.2.0-py2.6.egg/zc/buildout/easy_install.py", line 595, in _maybe_add_setuptools
    if ws.find(requirement) is None:
  File "/Library/Python/2.6/site-packages/pkg_resources.py", line 515, in find
    raise VersionConflict(dist,req)     # XXX add more info
VersionConflict: (setuptools 0.8 (/Library/Python/2.6/site-packages/setuptools-0.8-py2.6.egg), Requirement.parse('setuptools==0.6c11'))

此错误类似于此处讨论的错误:How to solve pkg_resources.VersionConflict error during bin/python bootstrap.py -d

关键区别在于我的错误告诉我从0.8版降级到0.6cll,而链接帖中的错误需要升级才能解决错误。

还要注意声明:Requirement.parse('setuptools == 0.6c11')。这似乎需要精确匹配,即使安装了较新版本也会导致错误。

事实上,我已经尝试降级到版本0.6c11,我收到以下错误消息:

Error: There is a version conflict.
We already have: setuptools 0.6c11
but distribute 0.7.3 requires 'setuptools>=0.7'.
but zc.buildout 2.2.0 requires 'setuptools>=0.7'.

所以似乎Some Thing需要setuptoos == 0.6c11而Another Thing需要setuptools> = 0.7。我很确定我不能满足这两个要求。

我正在尝试在Mac OsX 10.7上设置开发环境并使用Python 2.6版(项目所需)。任何想法如何解决这个问题?

非常欢迎任何帮助。

1 个答案:

答案 0 :(得分:1)

我能够解决此问题并发布解决方案,以防有人遇到同样的问题。

事实证明,问题是由于使用Xcode Dev Tools附带的python 2.6版本引起的。这个版本的python坚持使用setuptools版本0.6c11。由于我正在安装的应用程序(Plone CMS)中的其他东西需要一个版本的setuptools> = 0.7,我无法使用这个Mac提供的Python版本。

相反,我从源代码安装了python 2.6的备用版本(可在此处获取:http://www.python.org/download/releases/2.6.7/)。我使用了新安装的python版本,并且能够成功运行bootstrap.py脚本。