更新到最新版本的AWS CLI工具

时间:2017-09-27 19:08:33

标签: python amazon-web-services

最近注意到我正在运行旧版本的AWS CLI,缺少我需要的一些功能。我试着用下一个命令安装最后一个版本,但是我收到了一个错误。我在没有sudo -H的情况下尝试了同样的错误。我也在sudo -H pip install --upgrade pip

之前尝试过
MacBook-Pro-de-lopes: lopes$ sudo -H pip install --upgrade awscli
Password:
Collecting awscli
  Using cached awscli-1.11.160-py2.py3-none-any.whl
Collecting PyYAML<=3.12,>=3.10 (from awscli)
Collecting rsa<=3.5.0,>=3.1.2 (from awscli)
  Using cached rsa-3.4.2-py2.py3-none-any.whl
Collecting docutils>=0.10 (from awscli)
  Using cached docutils-0.14-py2-none-any.whl
Collecting botocore==1.7.18 (from awscli)
  Using cached botocore-1.7.18-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.9 (from awscli)
  Using cached s3transfer-0.1.11-py2.py3-none-any.whl
Collecting colorama<=0.3.7,>=0.2.5 (from awscli)
  Using cached colorama-0.3.7-py2.py3-none-any.whl
Collecting pyasn1>=0.1.3 (from rsa<=3.5.0,>=3.1.2->awscli)
  Using cached pyasn1-0.3.6-py2.py3-none-any.whl
Requirement already up-to-date: jmespath<1.0.0,>=0.7.1 in /Library/Python/2.7/site-packages (from botocore==1.7.18->awscli)
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.7.18->awscli)
  Using cached python_dateutil-2.6.1-py2.py3-none-any.whl
Requirement already up-to-date: futures<4.0.0,>=2.2.0; python_version == "2.6" or python_version == "2.7" in /Library/Python/2.7/site-packages (from s3transfer<0.2.0,>=0.1.9->awscli)
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore==1.7.18->awscli)
  Using cached six-1.11.0-py2.py3-none-any.whl
Installing collected packages: PyYAML, pyasn1, rsa, docutils, six, python-dateutil, botocore, s3transfer, colorama, awscli
  Found existing installation: six 1.4.1
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-VB3Shu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'

我也尝试过:

sudo -H python -m pip install --upgrade pip,
Password:
Invalid requirement: 'pip,'
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 82, in __init__
    req = Requirement(req)
  File "/Library/Python/2.7/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
    requirement_string[e.loc:e.loc + 8]))
InvalidRequirement: Invalid requirement, parse error at "','"

1 个答案:

答案 0 :(得分:1)

试试这个:

sudo -H pip install --upgrade awscli --ignore-installed six

这应该解决“卸载已安装的distutils项目(六)已被弃用”的问题。看起来基本问题最近已得到修复,因为我没有必要使用--ignore-installed选项进行最后几次升级。