[AWS] 在 Mac 上安裝 AWS CLI

[AWS] 在 Mac 上安裝 AWS CLI

今天想要在 macOS Catalina 上安裝 AWS CLI,

結果用 python 2 安裝時一直出現錯誤訊息,

看起來像是沒有權限寫入 /private/tmp:

testuser@localhost ~ $ sudo pip install awscli

ERROR: Could not install packages due to an EnvironmentError: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.pyc', '/private/tmp/pip-uninstall-2btTrN/parser.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/parser.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.py', '/private/tmp/pip-uninstall-2btTrN/relativedelta.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/relativedelta.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/zoneinfo-2010g.tar.gz', '/private/tmp/pip-uninstall-2btTrN/zoneinfo/zoneinfo-2010g.tar.gz', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/zoneinfo/zoneinfo-2010g.tar.gz'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.py', '/private/tmp/pip-uninstall-2btTrN/zoneinfo/__init__.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/zoneinfo/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.pyc', '/private/tmp/pip-uninstall-2btTrN/zoneinfo/__init__.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/zoneinfo/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo', '/private/tmp/pip-uninstall-2btTrN/zoneinfo', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/zoneinfo'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.py', '/private/tmp/pip-uninstall-2btTrN/tz.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/tz.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.pyc', '/private/tmp/pip-uninstall-2btTrN/relativedelta.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/relativedelta.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.pyc', '/private/tmp/pip-uninstall-2btTrN/rrule.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/rrule.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.py', '/private/tmp/pip-uninstall-2btTrN/__init__.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.py', '/private/tmp/pip-uninstall-2btTrN/parser.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/parser.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.py', '/private/tmp/pip-uninstall-2btTrN/tzwin.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/tzwin.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.py', '/private/tmp/pip-uninstall-2btTrN/rrule.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/rrule.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.pyc', '/private/tmp/pip-uninstall-2btTrN/__init__.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.py', '/private/tmp/pip-uninstall-2btTrN/easter.py', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/easter.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.pyc', '/private/tmp/pip-uninstall-2btTrN/easter.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/easter.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.pyc', '/private/tmp/pip-uninstall-2btTrN/tz.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/tz.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.pyc', '/private/tmp/pip-uninstall-2btTrN/tzwin.pyc', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN/tzwin.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil', '/private/tmp/pip-uninstall-2btTrN', "[Errno 1] Operation not permitted: '/private/tmp/pip-uninstall-2btTrN'")]

 

改 /private/tmp 的權限也沒用,

後來發現用 python 3 的就沒有問題:

sudo pip3 install awscli

 

這樣 AWS CLI 就已經可以用囉:

testuser@localhost ~ $ aws -h

Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

 

(本頁面已被瀏覽過 263 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料