0

我正在运行安装了 Python 2.5-2.7 的 Mac OSX 10.7.5。我的应用程序的依赖项之一是 newrelic 1.9.0.13(位于此处)。当我为 Python 2.6 或 2.7 引导和构建时,一切都完美无缺;但不是当我指定 2.5 时:

[buildout]
...
python = python

[python]
executable = /usr/bin/python2.5

使用此配置,运行 buildout 失败并出现以下错误:

Installing newrelic.
Getting distribution for 'newrelic==1.9.0.13'.
newrelic/lib/simplejson/_speedups.c: In function ‘encoder_listencode_obj’:
newrelic/lib/simplejson/_speedups.c:2263: warning: comparison of distinct pointer types lacks a cast
newrelic/lib/simplejson/_speedups.c:2263: warning: passing argument 2 of ‘PyType_IsSubtype’ from incompatible pointer type
zip_safe flag not set; analyzing archive contents...
newrelic.admin: module references __file__
newrelic.console: module references __file__
newrelic.bootstrap.sitecustomize: module references __file__
newrelic.core.environment: module references __file__
newrelic.core.thread_profiler: module references __file__
newrelic.lib.__init__: module references __path__
While:
  Installing newrelic.
  Getting distribution for 'newrelic==1.9.0.13'.
Error: Couldn't install: newrelic 1.9.0.13

easy_installing tarball 直接产生相同的消息,但是安装成功。这并不特定于 newrelic 包;如果我删除该依赖项,PIL 也会发生同样的事情(同样,仅在使用 Python 2.5 时)。

如果我改为使用分发,则在运行 buildout 时会出现不同的错误:

Traceback (most recent call last):
  File "./bin/buildout", line 17, in <module>
    import zc.buildout.buildout
  File "/Users/mjt/.buildout/eggs/zc.buildout-1.6.3-py2.7.egg/zc/buildout/buildout.py", line 40, in <module>
    import zc.buildout.download
  File "/Users/mjt/.buildout/eggs/zc.buildout-1.6.3-py2.7.egg/zc/buildout/download.py", line 20, in <module>
    from zc.buildout.easy_install import realpath
  File "/Users/mjt/.buildout/eggs/zc.buildout-1.6.3-py2.7.egg/zc/buildout/easy_install.py", line 75, in <module>
    pkg_resources.Requirement.parse('setuptools')
AttributeError: 'NoneType' object has no attribute 'location'

(我不确定这是否相关;我将其包括在内以防万一。)

为什么软件包无法安装,我该如何解决?

几点注意事项:

  • 无论我使用配方 (zc.recipe.egg) 包含包还是将其install_requires列在我的 setup.py 列表中,都会发生错误
  • 包下载成功;错误发生在安装过程中。
  • 相同的配置在 Python 2.6 和 2.7 中无需更改即可工作

谢谢!

4

2 回答 2

2

新的 Bootsrtrap.py 发布,旧的无法工作。

尝试 python bootstrap.py -v 1.7.0 使旧的正确运行或使用新的

于 2013-02-11T21:33:19.797 回答
1

@Cyril,您的解决方案对我很有用!谢谢。

我以前遇到过这个问题,并且能够通过换入更新的 bootstrap.py 文件来解决它,但是由于我的一些构建在周末开始神秘地失败,这次我费心查看 bootstrap.py代码。

我发现如果您不指定版本(zc.buildout 版本),bootstrap.py 将下载最新版本,这可能与您的 bootstrap.py 版本不兼容(很遗憾,它不可能很多有关此的更多信息)。

python bootstrap.py --version 1.7 # compatible zc.buildout version number

我敢说最近有几个人会收到这个错误,因为zc.buildout 的2.0 版刚刚发布。有几个地方可以下载 bootstrap.py,但http://downloads.buildout.org/是官方来源。道德是,如果可以的话,请保持最新。

于 2013-02-12T00:25:08.410 回答