首页 > 解决方案 > 将 AWS cli 更新到最新版本时出错

问题描述

我正在尝试将 AWS CLI 更新到最新版本。我正在关注以下 AWS 文档:

使用 sudo 访问的 Aws cli 升级

当我运行命令时:

sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws  

我收到一个很长的 python 错误,我无法理解。这里有什么问题?

错误信息:

Deprecated Python version detected: Python 2.7
Starting July 15, 2021, the AWS CLI will no longer support this version of Python. To continue receiving service updates, bug fixes, and security updates please upgrade to Python 3.6 or later. More information can be found here: https://aws.amazon.com/blogs/developer/announcing-end-of-support-for-python-2-7-in-aws-sdk-for-python-and-aws-cli-v1/
Running cmd: /bin/python virtualenv.py --no-download --python /bin/python /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-binary :all: --no-cache-dir --no-index --find-links file://. setuptools_scm-3.3.3.tar.gz
Traceback (most recent call last):
  File "./awscli-bundle/install", line 270, in <module>
    main()
  File "./awscli-bundle/install", line 247, in main
    pip_install_packages(opts.install_dir)
  File "./awscli-bundle/install", line 167, in pip_install_packages
    _install_setup_deps(pip_script, '.')
  File "./awscli-bundle/install", line 184, in _install_setup_deps
    pip_script, setup_package_dir, setuptools_scm_tarball))
  File "./awscli-bundle/install", line 90, in run
    p.returncode, cmd, output))
__main__.BadRCError: Bad rc (1) for cmd '/usr/local/aws/bin/pip install --no-binary :all: --no-cache-dir --no-index --find-links file://. setuptools_scm-3.3.3.tar.gz': Looking in links: file://.
Processing ./setuptools_scm-3.3.3.tar.gz
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    ERROR: Command errored out with exit status 1:
     command: /usr/local/aws/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-M9znG_/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-M9znG_/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-req-build-M9znG_/pip-egg-info
         cwd: /tmp/pip-req-build-M9znG_/
    Complete output (36 lines):
    running egg_info
    creating /tmp/pip-req-build-M9znG_/pip-egg-info/setuptools_scm.egg-info
    writing /tmp/pip-req-build-M9znG_/pip-egg-info/setuptools_scm.egg-info/PKG-INFO
    writing top-level names to /tmp/pip-req-build-M9znG_/pip-egg-info/setuptools_scm.egg-info/top_level.txt
    writing dependency_links to /tmp/pip-req-build-M9znG_/pip-egg-info/setuptools_scm.egg-info/dependency_links.txt
    writing entry points to /tmp/pip-req-build-M9znG_/pip-egg-info/setuptools_scm.egg-info/entry_points.txt
    writing manifest file '/tmp/pip-req-build-M9znG_/pip-egg-info/setuptools_scm.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-M9znG_/setup.py", line 118, in <module>
        setuptools.setup(**arguments)
      File "/usr/local/aws/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/local/aws/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
        self.find_sources()
      File "/usr/local/aws/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
        mm.run()
      File "/usr/local/aws/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
        self.add_defaults()
      File "/usr/local/aws/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 574, in add_defaults
        rcfiles = list(walk_revctrl())
      File "/usr/local/aws/lib/python2.7/site-packages/setuptools/command/sdist.py", line 20, in walk_revctrl
        for item in ep.load()(dirname):
      File "/tmp/pip-req-build-M9znG_/src/setuptools_scm/integration.py", line 22, in find_files
        command = ep.load()
      File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
        return self.resolve()
      File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2453, in resolve
        raise ImportError(str(exc))
    ImportError: 'module' object has no attribute 'FILES_COMMAND'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

标签: pythonlinuxpython-2.7aws-cli

解决方案


推荐阅读