gpt4 book ai didi

python - 构建:使用来自系统 Python 的依赖项

转载 作者:太空宇宙 更新时间:2023-11-03 13:51:43 24 4
gpt4 key购买 nike

我正在尝试使用 buildout对于一个 Python 包,它在使用时依赖于 2 个扩展模块:dbus-pythonpygobject .这两个模块都会导致构建失败:dbus-python 缺少一个 setup.py 文件,而 pygobject 有一个但不鼓励使用它 -- 而不是 <应该使用 em>configure, make, make install。因此,buildout 无法在开发环境中设置这些依赖项。

这是我的buildout.cfg:

[buildout]
develop = .
parts = eggs

[python]
recipe = zc.recipe.eggs
interpreter = python
eggs = foobar

foobar 包的 setup.py 包含:

install_requires=['dbus-python', 'pygobject'],

在寻找解决方案时,我偶然发现了食谱 z3c.recipe.scripts 及其 ability to utilize system-wide installed eggs .但是,当应用于我的 buildout.cfg ..

[python]
recipe = z3c.recipe.scripts
include-site-packages = true
allowed-eggs-from-site-packages = pygobject, dbus-python
interpreter = python
eggs = foobar

.. 它似乎没有效果(仍然失败),尽管两个包(dbusgobject)都安装在我的系统 Python 中。当我删除 allowed-eggs.. 行时也是如此。

我的问题:我是不是在概念层面上弄错了,还是我的 buildout.cfg 有错误?

我知道有 zc.recipe.cmmi ,一个使用 configure, make, make install 安装 eggs 的方法。然而,在我的例子中,简单地引用系统 Python eggs 就足够了。我不需要由 buildout 生成的 100% 可重现的环境。此外,dbus-pythonpygobject 默认安装在大多数 Linux 桌面系统上,foobar 旨在使用该环境。

最佳答案

我也没有获得最新的 1.5.x 构建来使用系统包。有一种方法:固定版本。那样的话,zc.buildout 1.5.x 就会接受它。

[buildout]
...
versions = versions

[versions]
pygobject = 1.2.3

或者,按照我的做法,您可以结合使用旧的 1.4.4 构建(您需要一个特殊的 bootstrap.py,谷歌搜索)与 osc.recipe.sysegg 结合使用.

[buildout]
...
parts =
...
sysegg

[sysegg]
recipe = osc.recipe.sysegg
force-sysegg = true
eggs =
dbus-python
pygobject

我个人会选择 osc.recipe.sysegg 解决方案,因为它很可靠。

关于python - 构建:使用来自系统 Python 的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7235572/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com