Openshift V3上的Python 2.7:在构建之前更新setuptools吗? [英] Python 2.7 on Openshift V3: update setuptools before build?
问题描述
在安装cryptography
软件包时,出现以下错误:
When installing cryptography
package I get the following error:
Invalid environment marker: platform_python_implementation != 'PyPy'
似乎升级setuptools可以解决此问题.有什么方法可以编辑Build Config YAML文件,以便pip install --upgrade setuptools
在任何程序包构建之前运行?
It seems upgrading setuptools would solve this. Is there a way I could edit Build Config YAML file so that pip install --upgrade setuptools
runs before any package is built?
推荐答案
运行:
oc set env bc/yourappname UPGRADE_PIP_TO_LATEST=true
请参阅:
执行此操作时,应更新pip
,setuptools
和wheel
软件包.
When you do this it should update pip
, setuptools
and wheel
packages.
唯一的问题是,此时此刻,在基于RHEL的Python S2I映像中还没有进行setuptools
和wheel
的更新.因此,如果您使用的是OpenShift容器平台(由OpenShift Online使用),它将无法按要求运行.
Only problem is that right at this minute, the changes that were made such that setuptools
and wheel
were also updated aren't yet in RHEL based Python S2I images. So if you are using OpenShift Container Platform (as used by OpenShift Online), it will not work as required.
解决方法的第一个选择是暂时使用基于CentOS的映像:
First option to workaround that is to use the CentOS based images instead for now:
oc new-app centos/python-27-centos7~https://url-to-your-repo
第二个选项是在您的源代码存储库中添加一个名为.s2i/bin/assemble
的可执行外壳脚本,其中包含:
Second option is to add an executable shell script called .s2i/bin/assemble
in your source code repo which contains:
#!/bin/bash
set -eo pipefail
pip install --upgrade pip setuptools wheel
/usr/libexec/s2i/assemble
这将代替常规的assemble
脚本执行,从而允许您安装更新.然后,您运行原始的assemble
脚本.
This will be executed instead of the normal assemble
script, allowing you to install the updates. You then run the original assemble
script.
这篇关于Openshift V3上的Python 2.7:在构建之前更新setuptools吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!