我可以更新Amazon的旧版本的pip和setuptools吗? [英] Can I update Amazon's old versions of pip and setuptools?

查看:111
本文介绍了我可以更新Amazon的旧版本的pip和setuptools吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以更新或删除AWS Elastic Beanstalk随附的pip和setuptools吗?

Can I update or remove the pip and setuptools provided with AWS Elastic Beanstalk?

AWS Elastic Beanstalk Python环境随附的pip和setuptools版本(在运行我的应用程序的2.7虚拟环境中,在ami-d14608e1中;在/opt/python/run/venv/lib/python2.7/site-packages中)非常老:如

The versions of pip and setuptools provided with my AWS Elastic Beanstalk Python environments (in the 2.7 virtual environment running my application, ami-d14608e1; in /opt/python/run/venv/lib/python2.7/site-packages) are very old: as reported by

pip list --outdated

他们是

setuptools (Current: 2.2 Latest: 12.0.5)
pip (Current: 1.5.4 Latest: 6.0.7)

我可以更新这些版本(例如通过在requirements.txt中列出它们)还是EB的Python和部署过程正常工作所需或需要这些特定版本?

Can I update these (e.g. by listing them in my requirements.txt) or are these specific versions expected by or needed for EB's Python and deployment processes to work?

推荐答案

pip为例,默认的AWS环境通常提供旧版本.当前它是我使用的计算机上的6.1.1,而pip在每次调用9.0.1可用时重复.

Taking pip as an example, the default AWS environment provides usually an old version. Currently it is a 6.1.1 on a machine I use, while pip repeats at each call that 9.0.1 is available.

依赖项有时需要pip的最新版本.一种可用的方式是依靠pip本身,因为AWS提供的yum来源升级速度较慢(由于可能造成的巨大影响...).

Dependencies sometimes require recent versions of pip. One way to have it available is to rely on pip itself, as the yum sources provided by AWS are slower to upgrade (due to the sheer impact that would cause...).

不同的AWS服务具有不同的解决方案.问题是关于Beanstalk的问题.假设基于AWS提供的eb进行部署,则可以在目标容器中执行命令:

Different AWS services have different solutions. The question is about Beanstalk. Assuming deployment based on eb provided by AWS, it is possible to execute commands in the target container:

  • 创建一个.ebextensions/upgrade_pip.config文件.
  • 插入要执行的命令.
  • Create a .ebextensions/upgrade_pip.config file.
  • Insert the command to execute.

要升级pip,请执行以下命令:

To upgrade pip, a command like this does the job:

commands:
  pip_upgrade:
    command: /opt/python/run/venv/bin/pip install --upgrade pip
    ignoreErrors: false

请注意,.ebextensions/upgrade_pip.config的文件名定义了执行顺序.如果它需要早于.ebextensions中的任何其他脚本运行,则必须使用01_upgrade...之类的前缀.

Note that the file name for .ebextensions/upgrade_pip.config defines the order of execution. If it needs to run earlier than any other script in .ebextensions, a prefix like 01_upgrade... is necessary.

这篇关于我可以更新Amazon的旧版本的pip和setuptools吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆