gpt4 book ai didi

python - 如何获得在 Pivotal Cloud Foundry 上运行的 python xmlsec 库

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:03:50 26 4
gpt4 key购买 nike

我正在尝试让 python 模块 python3-saml 在使用标准 python buildpack 和 cflinuxfs2 堆栈的 cloud foundry 应用程序上运行。该模块依赖于 python xmlsec 模块作为依赖项,但不幸的是我遇到了让它工作的问题。

我已经整理了一个需求文件并提供了所有 python 依赖项,但是当我运行“cf push”命令时,我不断收到以下错误。

            Running setup.py install for xmlsec: started
Running setup.py install for xmlsec: finished with status 'error'
Complete output from command /tmp/contents998689849/deps/0/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwwtrplp/xmlsec/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qwoda574-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
*********************************************************************************
Could not find xmlsec1 config. Are libxmlsec1-dev and pkg-config installed?
*********************************************************************************

----------------------------------------
Command "/tmp/contents998689849/deps/0/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwwtrplp/xmlsec/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-qwoda574-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-lwwtrplp/xmlsec/
pip install has failed. You have a vendor directory, it must contain all of your dependencies.
**ERROR** Could not install pip packages: Couldn't run pip: exit status 1
Failed to compile droplet: Failed to run all supply scripts: exit status 14
Exit status 223

我尝试手动上传适当的 libxmlsec1-dev 和 libxmlsec1 并设置一个环境变量来引用它们,但是暂存过程似乎只是在设置包时忽略了它们。

我可以做些什么来使这个过程正常运行?我想在某个地方有一个自定义的 buildpack 可以做到这一点,但我不确定是否有办法使用标准的 python buildpack 来做到这一点。

最佳答案

主要的选择是出售您的依赖项。使用此选项,您可以在本地构建,然后也推送所有已编译的位。诀窍在于您必须在兼容的系统上构建,因此您需要一个 Ubuntu Trusty PC/VM/Docker 容器。

按照这些说明操作,然后运行 ​​cf push 并确保您没有忽略 vendor 目录(从 .cfignore 中删除,如果存在的话)。

https://docs.cloudfoundry.org/buildpacks/python/index.html#vendoring

另一个可行的选项是使用多构建包支持。有了这个,您可以使用两个构建包进行推送。第一个是 Apt buildpack第二个是 python buildpack。 Apt buildpack允许你安装你需要的包,它看起来像 libxmlsec1-dev。第二个只是标准的 Python 构建包,但它可以访问通过 Apt 构建包安装的内容。

您可以在此处查看说明:https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html

关于python - 如何获得在 Pivotal Cloud Foundry 上运行的 python xmlsec 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52169554/

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