命令"aws configure"给出以下错误!
"aws configure":
$ aws configure
Traceback (most recent call last):
File "/usr/bin/aws", line 23, in <module>
sys.exit(main())
File "/usr/bin/aws", line 19, in main
return awscli.clidriver.main()
File "/usr/share/awscli/awscli/clidriver.py", line 44, in main
driver = create_clidriver()
File "/usr/share/awscli/awscli/clidriver.py", line 53, in create_clidriver
event_hooks=emitter)
File "/usr/share/awscli/awscli/plugin.py", line 49, in load_plugins
plugin.awscli_initialize(event_hooks)
File "/usr/share/awscli/awscli/handlers.py", line 73, in awscli_initialize
register_removals(event_handlers)
File "/usr/share/awscli/awscli/customizations/removals.py", line 32, in register_removals
'verify-email-address'])
File "/usr/share/awscli/awscli/customizations/removals.py", line 45, in remove
self._create_remover(remove_commands))
File "/usr/lib/python3/dist-packages/botocore/hooks.py", line 64, in register
self._verify_accept_kwargs(handler)
File "/usr/lib/python3/dist-packages/botocore/hooks.py", line 84, in _verify_accept_kwargs
argspec = inspect.getargspec(func)
File "/usr/lib/python3.4/inspect.py", line 936, in getargspec
raise ValueError("Function has keyword-only arguments or annotations"
ValueError: Function has keyword-only arguments or annotations, use getfullargspec() API which can support them
无法理解"ValueError"是什么
您可能刚刚将python升级到3.4.1。
Ubuntu 14.04托管的AWS CLI和botocore版本与python 3.4.1+不兼容。(源)
通过apt-get安装的命令行版本过期。Python 3.4.1引入了getargspec()函数的突破性变化,我们在botocore中使用了该函数。(源)
你可以试试:(我没有testbox与我验证)
sudo apt-get remove awscli
sudo apt-get install python-pip
sudo pip install awscli
sudo pip install upgrade botocore
似乎aws cli不能很好地与python 3兼容。
inspect.getargspec(函数)
获取Python函数参数的名称和默认值。返回一个命名元组ArgSpec(args, varargs, keywords, defaults)。Args是参数名称的列表。可变参数和关键字是*和**参数的名称或None。defaults是一个包含默认参数值的元组,如果没有默认参数则为None;如果这个元组有n个元素,它们对应args中列出的最后n个元素。
3.0版后已弃用:使用signature()和signature Object,它们为可调用对象提供了更好的自省API。此函数将在Python 3.6中删除。
可以尝试使用python 2.6或2.7吗?
Requires Python 2.6.5 or higher.
参考:
https://docs.python.org/3/library/inspect.html inspect.getargspec
https://aws.amazon.com/cli/您可以尝试以下步骤
sudo pip3 uninstall awscli
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 1
sudo pip3 install awscli