virtualenvwrapper のインストールでエラー

ubuntu 12.04 あたりにpython2.7.3で環境を作ろうとしたときの話です。
ez_setup.pyでeasy_installを入れて、
easy_installでpipを入れて、
virtualenvとvirtualenvwrapperを入れました。

そうすると、最後のvirtualenvwrapperのインストール中にエラーになり、パッケージ管理自体がおかしくなってしまい、最初から入れ直すハメに・・・

エラーはこんなのです。

[bash]
Scanning installed packages

Setuptools installation detected at /opt/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg

Egg installation

Patching…

Renaming /opt/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg into /opt/python2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg.OLD.1348674623.7

Patched done.

Relaunching…

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name ‘install’ is not defined

—————————————-
Command /opt/python2.7/bin/python -c "import setuptools;__file__=’/tmp/pip-build/distribute/setup.py’;exec(compile(open(__file__).read().replace(‘rn’, ‘n’), __file__, ‘exec’))" install –record /tmp/pip-PJad3a-record/install-record.txt –single-version-externally-managed failed with error code 1 in /tmp/pip-build/distribute
Storing complete log in /home/planset/.pip/pip.log

[/bash]

これはどうやらvirtualenvwrapperがdistributeをデフォルトで使うようになったために、パッケージ管理の部分を上書きしちゃってダメになるーっぽいです。

というわけで、新しくpythonを入れたときはez_setup.pyではなくて、
distribute_setup.pyを使ってインストールするといいかもです。

[bash]
curl -O http://python-distribute.org/distribute_setup.py
sudo /opt/python2.7/bin/python distribute_setup.py
[/bash]

これでやりなおしたら大丈夫でした。