Mountain Lionにしたんでpythonを入れなおした
いまさら1700円払ってMountain lionにしたので、pythonを入れなおした。
brewでpyhtonを入れる
$ brew install python ~~省略~~ Python demo /usr/local/share/python/Extras Distribute and Pip have been installed. To update them pip install --upgrade distribute pip install --upgrade pip To symlink "Idle" and the "Python Launcher" to ~/Applications `brew linkapps` You can install Python packages with (the outdated easy_install or) `pip install <your_favorite_package>` They will install into the site-package directory /usr/local/lib/python2.7/site-packages See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python Warning: Could not link python. Unlinking... Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local You can try again using `brew link python' ==> Summary /usr/local/Cellar/python/2.7.5: 5200 files, 80M, built in 5.4 minutes
$ brew link python Linking /usr/local/Cellar/python/2.7.5... Warning: Could not link python. Unlinking... Error: Could not symlink file: /usr/local/Cellar/python/2.7.5/bin/smtpd2.7.py Target /usr/local/bin/smtpd2.7.py already exists. You may need to delete it. To force the link and overwrite all other conflicting files, do: brew link --overwrite formula_name To list all files that would be deleted: brew link --overwrite --dry-run formula_name
$ brew link --overwrite --dry-run python Would remove: /usr/local/bin/smtpd2.7.py /usr/local/bin/smtpd.py /usr/local/bin/pythonw2.7 /usr/local/bin/pythonw /usr/local/bin/python2.7-config /usr/local/bin/python2.7 /usr/local/bin/python-config /usr/local/bin/python /usr/local/bin/pydoc2.7 /usr/local/bin/pydoc /usr/local/bin/pip-2.7 /usr/local/bin/pip /usr/local/bin/idle2.7 /usr/local/bin/idle /usr/local/bin/easy_install-2.7 /usr/local/bin/easy_install /usr/local/bin/2to3-2.7 /usr/local/bin/2to3
$ brew link --overwrite python Linking /usr/local/Cellar/python/2.7.5... 30 symlinks created
distributeのアップグレード
$ sudo pip install --upgrade distribute Password: Requirement already up-to-date: distribute in /usr/local/Cellar/git/1.7.9/lib/python2.7/site-packages Downloading/unpacking setuptools>=0.7 (from distribute) Downloading setuptools-0.8.tar.gz (756kB): 756kB downloaded Running setup.py egg_info for package setuptools Installing collected packages: setuptools Found existing installation: setuptools 0.6c11 Uninstalling setuptools: Successfully uninstalled setuptools Running setup.py install for setuptools Installing easy_install script to /usr/local/bin Installing easy_install-2.7 script to /usr/local/bin Successfully installed setuptools Cleaning up...
pipのアップグレード
$ sudo pip install --upgrade pip Requirement already up-to-date: pip in /usr/local/Cellar/git/1.7.9/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg Cleaning up...
virtualenvのインストール
$ sudo pip install virtualenv $ sudo pip install virtualenvwrapper $ mkdir ~/.virtualenvs
virtualenvの設定
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' export PIP_VIRTUALENV_BASE=$WORKON_HOME export PIP_RESPECT_VIRTUALENV=true source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenvでエラー
$ mkvirtualenv Traceback (most recent call last): File "/usr/local/bin/virtualenv", line 5, in <module> from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module> working_set.require(__requires__) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require needed = self.resolve(parse_requirements(requirements)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: virtualenv==1.8.2
バージョン指定してインストールし直し
$ sudo pip install virtualenv==1.8.2
これでmkvirtualenvできるようになった