awscli没有在OS X上工作,继续得到ImportError:没有名为awscli_plugin_endpoint

时间:2018-03-28 08:06:37

标签: python macos aws-cli

我最近通过brew upgrade打破了我的awscli安装。我一直在

ImportError: No module named awscli_plugin_endpoint

无论我使用什么python版本。

这是我已经尝试过的事情:

  • 使用brew
  • brew install awscli合作的当前python版本
  • pyenv与2.7.14和3.6.4,
  • virtualenv使用此gist
  • pyenv使用此other gist
  • 从1.14.65手动安装tarball到1.14.62。

无论我做什么,它总是抱怨

No module named awscli_plugin_endpoint

我已经擦除了完整的brew安装,擦除了所有pyenvs,删除了点dirs .local.pyenv。唯一仍然存在的是OS X附带的系统安装python。

使用zsh运行OS X 10.13.3。

这里有什么问题?

Python 2.7的示例堆栈跟踪:

$ aws --version
Traceback (most recent call last):
  File "/Users/dhiller/pyenvs/aws/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/Users/dhiller/pyenvs/aws/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/clidriver.py", line 58, in main
    driver = create_clidriver()
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/clidriver.py", line 69, in create_clidriver
    event_hooks=emitter)
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/plugin.py", line 44, in load_plugins
    modules = _import_plugins(plugin_mapping)
  File "/Users/dhiller/pyenvs/aws/lib/python2.7/site-packages/awscli/plugin.py", line 58, in _import_plugins
    plugins.append(__import__(path))
ImportError: No module named awscli_plugin_endpoint

2 个答案:

答案 0 :(得分:0)

解决方案很简单 - just use the pip that's matching the python installation to install the endpoint manually

# this also installs python as a dependency
$ brew install awscli
$ /usr/local/opt/awscli/libexec/bin/pip install awscli-plugin-endpoint
$ aws --version                                                                                                                                                     
aws-cli/1.14.60 Python/3.6.4 Darwin/17.4.0 botocore/1.9.13

或删除~/.aws/config中的插件条目:

[plugins]
endpoint = awscli_plugin_endpoint

答案 1 :(得分:0)

我必须承认,这花了我比原本更长的时间,这可能不是解决问题的最佳方法,但是我的aws版本没有pip,所以我只是复制了插件(需要管理员权限)

C:\Users\blackstrype>pip install awscli-plugin-endpoint
Requirement already satisfied: awscli-plugin-endpoint in *__c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages__* (0.4)
Requirement already satisfied: awscli>=1.11.0 in c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages (from awscli-plugin-endpoint) (1.18.138)
Requirement already satisfied: docutils<0.16,>=0.10 in c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages (from awscli>=1.11.0->awscli-plugin-endpoint) (0.15.2)
Requirement already satisfied: colorama<0.4.4,>=0.2.5; python_version != "3.4" in c:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages (from awscli>=1.11.0->awscli-plugin-endpoint) (0.4.3)

复制 C:\users\blackstrype\appdata\local\programs\python\python38-32\lib\site-packages\awscli-plugin-endpoint*C:\Program Files\Amazon\AWSCLI\runtime\Lib\site-packages