10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pipのインストールにハマって悲しい思いをしているたぶんEl Capitanなあなたへ

Last updated at Posted at 2016-05-02

いつの間にかpipのインストールが楽になってた件

python get-pip.py
これを入れても

Collecting pip
  Using cached pip-8.1.1-py2.py3-none-any.whl
Collecting wheel
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Exception:
Traceback (most recent call last):
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/pip.zip/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/pip.zip/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/pip.zip/pip/req/req_set.py", line 732, in install
    **kwargs
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/pip.zip/pip/req/req_install.py", line 835, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/pip.zip/pip/req/req_install.py", line 1030, in move_wheel_files
    isolated=self.isolated,
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/pip.zip/pip/wheel.py", line 344, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/pip.zip/pip/wheel.py", line 315, in clobber
    ensure_dir(destdir)
  File "/var/folders/1s/zx_tbsz12q11ff8h79g8yqy40000gn/T/tmpXAEHyo/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'

こういうの出がちですよね。

そこでこういうの入れても

curl -kL https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100   260  100   260    0     0     95      0  0:00:02  0:00:02 --:--:--     0
You're using an outdated location for the get-pip.py script, please use the one available from https://bootstrap.pypa.io/get-pip.py

時代遅れだよ、などと言われてしまいます。

↓たぶんこの1行で解決です。

//bootstrap.pypa.io/get-pip.py | sudo python

get-pip.pyの場所が変わってるみたいですね。
なんか「このディレクトリはあんたの権限じゃないよ」とか言われてもsudoすれば通ります。

(追記)
※どうもEl Capitanになってpipのインストールがハマりやすくなっているっぽいです。sudoしても通らないことがしばしばある様子。

http://stackoverflow.com/questions/32898583/unable-to-install-nltk-on-mac-os-el-capitan

あとそもそもPythonは3.5とかも出てるけど2.7のほうが無難っぽい。

pipは普通に入れると管理者権限から外れてしまって結構厄介なようなので、管理者権限の中に入るようにダウンロード場所を工夫するのが吉のよう。
http://hacknote.jp/archives/19074/

10
9
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?