Homebrew

2012年09月05日

OSXにpythonは入っているが、pipがちゃんと動かない。
homebrewを使って、改めて入れ直すことにする。
OS標準では、/usr/bin/pythonであるが、homebrewは/usr/local/binに入れてくれるので、後でpathを登録する必要がある。

1.HOMEBREWのインストール

 $ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)

インストール後の自己診断

 $ brew doctor
Warning: You have Macports or Fink installed.
This can cause trouble. You don't have to uninstall them, but you may like to
try temporarily moving them away, eg.

  sudo mv /opt/local ~/macports 

macportsが入っているから、消せといわれる。
ま、ディレクトリ名を変えておけばいいだろう。

 $ brew doctor
Your system is raring to brew.  

ちゃんと通った。

2.pythonのインストール

早速インストールをする。

 $ brew install python
Unsatisfied dependency: XQuartz 
Please install the latest version of XQuartz:
  https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.  

XQuartzがないと怒られる。
pythonでX11がいるとは、驚きだがしかたない。以下からダウンロードして入れる。

3.XQuartzのインストール

以下らからISOをダウンロードして、インストーラを起動。

http://xquartz.macosforge.org/landing/

4.pipの修正

再度pythonのインストールをトライ。

 $ brew install python 

またエラーが出た。

 ==> Downloading http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/pip-1.1.tar.gz
config.log was copied to /Users/terauchiyasuyuki/Library/Logs/Homebrew
Error: SHA1 mismatch
Expected: 842c4e2aff3f016feea3c6e992c7fa96e49c9aa0
Actual: 3b002db66890880ee776bbe199c3d326d8fe3d6f
Archive: /Library/Caches/Homebrew/pip-1.1.tar.gz
(To retry an incomplete download, remove the file above.) 

pipをダウンロードしたtar.gzが違うという。
いろいろ試行錯誤をしたが、結局、homebrewに登録されているハッシュ値が間違っているという結論。
以下のコマンドで、ハッシュ値を修正する。

 $ brew edit python 

変更前の23行めから26行め。

 23 class Pip < Formula
 24   url 'http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz'
 25   sha1 '842c4e2aff3f016feea3c6e992c7fa96e49c9aa0'
 26 end 

以下のように変更。

 23 class Pip < Formula
 24   url 'http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz'
 25   sha1 '3b002db66890880ee776bbe199c3d326d8fe3d6f'
 26 end 

5.最後、ほんとのpythonインストール

これで再度 $ brew install pythonをすると無事終了した。
PATHを/usr/local/binを優先させて。 

 $ which python
/usr/local/bin/python

$ python --version
Python 2.7.3 


sylphide_ffr31mr at 23:55コメント(0)トラックバック(0) 
記事検索
最新コメント
プロフィール

やすき

月別アーカイブ
  • ライブドアブログ