読者です 読者をやめる 読者になる 読者になる

macOSにpipが入っていない

macOS Sierra
Version 10.12.2

% brew install pip
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
antlr                                              youtube-dl

Error: No available formula with the name "pip" 
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
  https://pip.readthedocs.io/en/stable/installing/
% curl -kL https://bootstrap.pypa.io/get-pip.py | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1558k  100 1558k    0     0  3886k      0 --:--:-- --:--:-- --:--:-- 3895k
Collecting pip
  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 912kB/s 
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 4.8MB/s 
Installing collected packages: pip, wheel
Exception:
Traceback (most recent call last):
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/var/folders/t_/1c8g5tlj7y70t3s4f3pvsqkm0000gn/T/tmpdpNht1/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'

sudo を付けるらしい

curl -kL https://bootstrap.pypa.io/get-pip.py | sudo python

インストールできた。