simplejsonを入れた
パッケージをどうこうしたりする作業は苦手だー。何をどういう順番で試すべきかすぐに忘れるので適当にやっつけてしまう。とりあえず試行錯誤した過程を晒して、識者に「いやそれ違う!」とか突っ込まれてみることにしよう。
- Q: simplejsonを必要とするスクリプトを実行する
- A: ImportError: No module named simplejsonと怒られる
- 「あー、simplejson入ってないのか」
- Q: sudo port install simplejsonってしてみる(言い忘れたけどOSはMacね)
- A: Error: Port simplejson not found
- 「portにはないのか。easy_installとか使うのかな。」
- Q: easy_で補完をしてみる
- A: easy_install easy_install-2.4 easy_install-2.5
- Q: $ easy_install simplejson
- A: No eggs found in /var/folders/jF/jFCv7+jlGWuEz+W8iRqbyE+++TI/-Tmp-/easy_install-VFdnbf/simplejson-2.0.9/egg-dist-tmp-fCKOyv (setup script problem?)
- 「あれ?sudo必要?」
- Q: $ sudo easy_install simplejson
- A: 同じエラー
- 「じゃあPyPIから落とすか。」
- ブラウザを開いてsimplejsonのページを見る。$ wget http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz
- $ tar -xzvf simplejson-2.0.9.tar.gz
- $ cd simplejson-2.0.9
- Q: $ ls
- A:
LICENSE.txt docs scripts simplejson PKG-INFO ez_setup.py setup.cfg simplejson.egg-info conf.py index.rst setup.py
- Q: $ python setup.py install
- A:
--------------------------------------------------------------------------- This script requires setuptools version 0.6c7 to run (even to display help). I will attempt to download it for you (from http://pypi.python.org/packages/2.6/s/setuptools/), but you may need to enable firewall access for this script first. I will start the download in 15 seconds. (Note: if this machine does not have network access, please obtain the file http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c7-py2.6.egg and place it in this directory before rerunning this script.) --------------------------------------------------------------------------- Downloading http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c7-py2.6.egg Traceback (most recent call last): (略) urllib2.HTTPError: HTTP Error 404: Not Found
- 「おいおい、setuptoolsを入れようとして失敗するじゃん」
- ブラウザでsetuptoolsのところを見る。
- 0.6c7はもうない。0.6c11がある。
- Q: $ sudo easy_install setuptools
Searching for setuptools Best match: setuptools 0.6c11 Processing setuptools-0.6c11-py2.5.egg ...
- (py2.5に入ってしまったことには気付いていない)
- $ python setup.py install
--------------------------------------------------------------------------- This script requires setuptools version 0.6c7 to run
- 「あれー。setuptoolsのeggからインストールしてみるか。」
- $ wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
- $ easy_install setuptools-0.6c11-py2.6.egg
Installed /Library/Python/2.5/site-packages/setuptools-0.6c11-py2.6.egg Processing dependencies for setuptools==0.6c11 Finished processing dependencies for setuptools==0.6c11
- $ python setup.py install
--------------------------------------------------------------------------- This script requires setuptools version 0.6c7 to run (even to display
- 「えー。」
- $ emacs ez_setup.py
import sys DEFAULT_VERSION = "0.6c7" DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
- 「とりあえずこれを0.6c11に書き換えてみるか」
- 「お、できた!」
途中2回のsetuptoolsのアップデートの失敗、ログを転載していて気付いたのだけどどっちもpython2.5に入っちゃってるじゃん。それが失敗の原因かー。
続きで、easy_install pitしたらまた2.5に入れられてしまった。ふと見たらeasy_install2.6が増えてる。そうか、いままでpythonが2.6なのにeasy_install(2.5用)、easy_install2.4, easy_install2.5という品揃えだったのか。
$ sudo easy_install-2.6 pit (略) Processing pit-0.2-py2.5.egg pit 0.2 is already the active version in easy-install.pth Using /Library/Python/2.5/site-packages/pit-0.2-py2.5.egg
む…。なぜそこに入る…。ダメだ、パッケージマネジメント力が足りない。面倒くさくなったので元スクリプトをいじってPitを使わないようにしてしまった。
追記:Python Package Index : virtualenv 1.4.3を使えと言われた。後で調べる。