本文介绍了带有Python 3.9.0a1的AWS CLI错误`从集合导入MuableMapping`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用pip在我的Python 3.9.0a1阿尔卑斯山坞站映像上安装了AWS CLI。安装进行得很顺利。当我运行aws命令时,出现以下错误。

 aws
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/usr/local/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/usr/local/lib/python3.9/site-packages/awscli/clidriver.py", line 68, in main
    driver = create_clidriver()
  File "/usr/local/lib/python3.9/site-packages/awscli/clidriver.py", line 77, in create_clidriver
    load_plugins(session.full_config.get('plugins', {}),
  File "/usr/local/lib/python3.9/site-packages/awscli/plugin.py", line 44, in load_plugins
    modules = _import_plugins(plugin_mapping)
  File "/usr/local/lib/python3.9/site-packages/awscli/plugin.py", line 61, in _import_plugins
    module = __import__(path, fromlist=[module])
  File "/usr/local/lib/python3.9/site-packages/awscli/handlers.py", line 42, in <module>
    from awscli.customizations.history import register_history_mode
  File "/usr/local/lib/python3.9/site-packages/awscli/customizations/history/__init__.py", line 24, in <module>
    from awscli.customizations.history.db import DatabaseConnection
  File "/usr/local/lib/python3.9/site-packages/awscli/customizations/history/db.py", line 19, in <module>
    from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/local/lib/python3.9/collections/__init__.py)



python --version
Python 3.9.0a1

我是否需要安装任何其他模块来修复此错误消息?

谢谢

推荐答案

collections.MutableMapping从Python3.3开始不再推荐使用,并从Python3.9开始正式删除。

摘自documentation

您可以等待awscli与Python3.9兼容的版本发布,也可以暂时自己修补aws脚本(在您的/usr/local/bin下):

...
import collections
from collections import abc
collections.MutableMapping = abc.MutableMapping
import awscli.clidriver

这篇关于带有Python 3.9.0a1的AWS CLI错误`从集合导入MuableMapping`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 15:12