Views: 44
M1 Mac(macOS Monterey version 12.3)でAWS(Amazon Web Service)のS3(Simple Storage Service)をコマンドで実行するs3cmdが Python3を3.10にアップデートしたら、次のメッセージでエラーとなった。
/usr/local/bin/s3cmd: /usr/local/Cellar/s3cmd/2.0.1/libexec/bin/s3cmd: /usr/bin/python: bad interpreter: No such file or directory
brewでs3cmdを更新ストールし解決
色々試したが、brew(brew install s3cmd)で解決した。
$ brew install s3cmd s3cmd 2.0.1 is already installed but outdated (so it will be upgraded). ... ==> Checking for dependents of upgraded formulae... ==> No broken dependents to reinstall! $ $ s3cmd --version s3cmd version 2.2.0 $ $ s3cmd ls s3://xxxx.jp DIR s3://xxxx.jp/yyyy/ DIR s3://xxxx.jp/zzzz/
最初にインストールしたのが10年くらい昔なので、そのときにbrewでインストールしていたらしい。
駄目だった手順を以降に記載する。
pip3 install awsは駄目
$ python3 --version Python 3.10.1 $ pip3 --version pip 22.0.4 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10) $ pip3 install aws Collecting aws Downloading aws-0.2.5.tar.gz (5.6 kB) Preparing metadata (setup.py) ... done ... $ which python /usr/local/bin/python $ python --version Illegal instruction: 4 $ pip3 install s3cmd Collecting s3cmd Downloading s3cmd-2.2.0-py2.py3-none-any.whl (153 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 153.9/153.9 KB 3.8 MB/s eta 0:00:00
/usr/local/bin/s3cmdの#!/bin/bashを変更しても駄目
$ cat /usr/local/bin/s3cmd #!/bin/bash PYTHONPATH="/usr/local/Cellar/s3cmd/2.0.1/libexec/lib/python2.7/site-packages:/usr/local/Cellar/s3cmd/2.0.1/libexec/vendor/lib/python2.7/site-packages" exec "/usr/local/Cellar/s3cmd/2.0.1/libexec/bin/s3cmd" "$@" Nobu-MacBook:~ pontsoleil$ cat /usr/local/Cellar/s3cmd/2.0.1/libexec/bin/s3cmd #!/usr/bin/python # -*- coding: utf-8 -*- ## -------------------------------------------------------------------- ## s3cmd - S3 client ## ## Authors : Michal Ludvig and contributors ## Copyright : TGRMN Software - http://www.tgrmn.com - and contributors ## Website : http://s3tools.org ## License : GPL Version 2 ## -------------------------------------------------------------------- ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## --------------------------------------------------------------------
s3cmd-2.0.2.tar.gzからの再インストールも駄目
$ wget https://sourceforge.net/projects/s3tools/files/s3cmd/2.0.2/s3cmd-2.0.2.tar.gz -bash: wget: command not found $ brew install wget Running `brew update --preinstall`... ==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/services).