简体   繁体   English

AWS Boto3 兼容性问题,如何安装旧版本的 Boto3?

[英]AWS Boto3 Compatibility Issue, How can I install an older version of Boto3?

I'm trying to deploy my Django project to AWS Elastic Beanstalk.我正在尝试将我的 Django 项目部署到 AWS Elastic Beanstalk。
The tutorial I am following is suggesting I use Boto3 to link up my S3 Database.我正在遵循的教程建议我使用 Boto3 来链接我的 S3 数据库。

The problem is when I am installing Boto3 i am getting this message in red.问题是当我安装 Boto3 时,我收到这条红色消息。

awsebcli 3.20.3 requires botocore<1.24.0,>1.23.41, but you have botocore 1.27.7 which is incompatible.

So I'm trying to install the older version of Botocore, 1.24.0 or 1.23.41, but after looking at PyPi I can't seem to find it since it just says use pip3 install boto3.所以我正在尝试安装较旧版本的 Botocore,1.24.0 或 1.23.41,但是在查看 PyPi 之后,我似乎找不到它,因为它只是说使用 pip3 install boto3。

Any suggestions?有什么建议么?

Try the following:尝试以下操作:
pip install boto3==1.21.21 pip install boto3==1.21.21
pip install botocore==1.24.21 pip install botocore==1.24.21

The best way to fix this is to use python virtual environments .解决此问题的最佳方法是使用python 虚拟环境

The AWS EB CLI is pegged to a very specific version of botocore and they don't update it very often. AWS EB CLI 与一个非常特定的 botocore 版本挂钩,他们不会经常更新它。 As a result, you don't want it to be in the mix for your project dependencies because it will make it hard for you to install other libraries (like modern versions of boto3).因此,您不希望它与您的项目依赖项混在一起,因为它会使您难以安装其他库(例如现代版本的 boto3)。

A general setup that you can use is the following:您可以使用的一般设置如下:

  1. Install awsebcli globally (you only need it for its scripts)全局安装 awsebcli(您只需要它的脚本)
  2. Make a virtual environment for your project为您的项目创建一个虚拟环境
  3. Install all of your project dependencies in the virtual env;在虚拟环境中安装所有项目依赖项; do not install awsebcli in the virtual env不要在虚拟环境中安装 awsebcli

If this doesn't work (such as you have other things you need to install globally with conflicting subdependenceis), you should install awsebcli in its own virtual env and have aliases to activate it, but that gets really messy.如果这不起作用(例如您需要全局安装其他具有冲突子依赖项的东西),您应该在其自己的虚拟环境中安装 awsebcli 并使用别名来激活它,但这会变得非常混乱。

I had the same problem: If you already installed boto3 then do these:我遇到了同样的问题:如果您已经安装了 boto3,请执行以下操作:

  1. pip uninstall boto3 pip 卸载boto3
  2. pip uninstall botocore pip 卸载 botocore
  3. pip uninstall s3transfer pip 卸载 s3transfer

then do these:然后做这些:

  1. pip install botocore==1.23.54 pip 安装 botocore==1.23.54
  2. pip install boto3==1.20.54 pip 安装boto3==1.20.54

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM