Buildout尝试更新系统范围的Distribute安装并拒绝运行

9 投票
5 回答
1839 浏览
提问于 2025-04-16 16:34

Buildout 不太喜欢我系统上安装的 Distribute,结果不愿意运行:

plone@s15447224:~/mybuildout$ python bootstrap.py 
Creating directory '/home/plone/mybuildout/bin'.
Creating directory '/home/plone/mybuildout/parts'.
Creating directory '/home/plone/mybuildout/eggs'.
Creating directory '/home/plone/mybuildout/develop-eggs'.
Getting distribution for 'distribute==0.6.14'.
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /usr/lib/python2.6/dist-packages
Non-egg installation
Removing elements out of the way...
Already patched.
/usr/lib/python2.6/dist-packages/setuptools.egg-info already patched.
After install bootstrap.
Creating /usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg-info
error: /usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg-info: Permission denied
An error occurred when trying to install distribute 0.6.14. Look above this message for any errors that were output by easy_install.
While:
  Bootstrapping.
  Getting distribution for 'distribute==0.6.14'.
Error: Couldn't install: distribute 0.6.14

有没有办法让 buildout 安装它自己的 Distribute,而不去影响系统上的 Python 安装呢?

我知道虚拟环境(virtualenv)。但是为了让 buildout 高兴而去安装虚拟环境似乎有点过于复杂了。肯定还有其他方法。

使用的 Python 版本是 2.6,Plone 版本是 4.1,操作系统是 Ubuntu 10.4。

5 个回答

3

我也遇到过这个问题。我通常是通过使用 virtualenv 来“解决”它,或者接受全局的 setuptools 需要更新,然后手动去更新,比如用 sudo easy_install -U setuptools(或者可能用 distribute 作为包名)。

这个问题 可能 是因为某些版本的 bootstrap.py 引起的。但这只是我的一个猜测。我在我的大多数 Plone 3 的构建中都会加上这个链接:http://svn.zope.org/*checkout*/zc.buildout/tags/1.4.4/bootstrap/bootstrap.py

4

是的,使用 Buildout 1.5.x 版本,这个版本在运行 Python 时会加上 '-S' 参数(-S 的意思是:初始化时不自动加载 'site' 模块)。

(你也可以试着把系统里的 Distribute 升级到最新版本)

3

看起来在 distribute_setup.py 这个文件里有个bug,目前的解决办法是使用 setuptools 的 bootstrap.py。

更新:更多细节可以查看 https://bitbucket.org/tarek/distribute/issue/231/bootstrappy-tries-to-modify-global-python#comment-1254375

更新2:已经修复,详情见 http://pypi.python.org/pypi/distribute/0.6.27#id2

撰写回答