Macbook ProからiMacに移行して、High Sierraにしたらaws cliが動かなくなった。
再インストールを試みたが、pipのインストールが以下のエラーを出力し失敗した。
$sudo python get-pip.py
The directory '/Users/ユーザー名/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/ユーザー名/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 1.2MB/s
Collecting wheel
Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
100% |████████████████████████████████| 51kB 10.7MB/s
Installing collected packages: pip, wheel
Exception:
Traceback (most recent call last):
File "/tmp/tmpRSsSoO/pip.zip/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/tmp/tmpRSsSoO/pip.zip/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/tmp/tmpRSsSoO/pip.zip/pip/req/req_set.py", line 784, in install
**kwargs
File "/tmp/tmpRSsSoO/pip.zip/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/tmp/tmpRSsSoO/pip.zip/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/tmp/tmpRSsSoO/pip.zip/pip/wheel.py", line 462, in move_wheel_files
generated.extend(maker.make(spec))
File "/tmp/tmpRSsSoO/pip.zip/pip/_vendor/distlib/scripts.py", line 372, in make
self._make_script(entry, filenames, options=options)
File "/tmp/tmpRSsSoO/pip.zip/pip/_vendor/distlib/scripts.py", line 276, in _make_script
self._write_script(scriptnames, shebang, script, filenames, ext)
File "/tmp/tmpRSsSoO/pip.zip/pip/_vendor/distlib/scripts.py", line 250, in _write_script
self._fileop.write_binary_file(outname, script_bytes)
File "/tmp/tmpRSsSoO/pip.zip/pip/_vendor/distlib/util.py", line 407, in write_binary_file
with open(path, 'wb') as f:
IOError: [Errno 1] Operation not permitted: '/bin/pip'
sudo に -H
オプションを指定することでインストールできた。
sudo -H python get-pip.py
急いでいたので理由の深追いはしていない。