使程序(aws cli)可供所有用户访问,并由pip安装

时间:2018-08-24 20:44:24

标签: python ubuntu pip aws-cli

我使用sudo pip install awscli安装了aws-cli 当我以当前用户身份运行awscli时,它可以工作,但是当我尝试以其他用户身份运行awscli时,我得到

sudo -u jenkins aws
Traceback (most recent call last):
  File "/usr/local/bin/aws", line 19, in <module>
    import awscli.clidriver
  File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 17, in <module>
    import botocore.session
  File "/usr/local/lib/python2.7/dist-packages/botocore/session.py", line 28, in <module>
    import botocore.client
  File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 16, in <module>
    from botocore import waiter, xform_name
  File "/usr/local/lib/python2.7/dist-packages/botocore/waiter.py", line 13, in <module>
    import jmespath
ImportError: No module named jmespath

1 个答案:

答案 0 :(得分:1)

我使用普通用户时发生了相同的问题。

# sudo -i    # switch to root
# aws configure          # give credencials

然后切换回普通用户。 aws configure适用于普通用户和root用户。