'AWSHTTPSConnection'对象没有属性'ssl_context'

Bar*_*vaz 17 aws-cli

Not working
    root@49161b16e779:/# aws --version
    aws-cli/1.11.121 Python/3.5.2 Linux/4.10.0-32-generic botocore/1.5.84
    root@49161b16e779:/# aws s3 ls s3://my.bucket.path
    'AWSHTTPSConnection' object has no attribute 'ssl_context'

Working fine
    tada@tada-VirtualBox:~$ aws --version
    aws-cli/1.11.13 Python/3.5.2 Linux/4.10.0-32-generic botocore/1.4.70
Run Code Online (Sandbox Code Playgroud)

以上是我最近遇到的一个问题,从2017年7月25日到8月3日.

Docker是节点:6.9.2.还尝试了'ubuntu'图像,同样的错误.

我似乎无法找到错误来源.有谁知道如何解决它?谢谢.

Mar*_*ery 25

这是由AWS CLI中的错误引起的,该错误在https://github.com/boto/botocore/issues/1258#issuecomment-321787841中指出,这使得它与较新版本的请求不兼容.如果您awscli使用Pip 安装,您将看不到该错误,因为您从Pip获得的版本具有旧的兼容版本的请求.但是如果您已经使用Apt(或者某些其他软件包管理器)安装了AWS CLI,那么您将获得一个使用系统的Requests模块的AWS CLI版本,从而使您面临此错误.

要修复,要么:

  1. 删除已安装的任何AWS CLI版本,并使用Pip重新安装.这可能意味着跑步apt remove awscli && pip install awscli.

......或者,如果由于某种原因你不能这样做:

  1. 请求降级到2.12版,根据https://github.com/boto/botocore/issues/1258#issuecomment-331746809与旧版AWS CLI兼容,运行pip uninstall requests && pip install requests==2.12pip3 uninstall requests && pip3 install requests==2.12.

我相信这个问题在botocore v1.11.0中固定的,所以最终,一旦Apt的存储库中的awscli版本使用了botocore版本> = v1.11.0,这个bug就会消失.