Skip to content

Instantly share code, notes, and snippets.

@pagles
Forked from shun115/gist:789529
Created July 21, 2011 12:56
Show Gist options
  • Save pagles/1097127 to your computer and use it in GitHub Desktop.
Save pagles/1097127 to your computer and use it in GitHub Desktop.
Python : pythonbrew + virtualenv 環境の構築
$ curl -kLO https://github.com/utahta/pythonbrew/raw/master/pythonbrew-install
$ chmod +x pythonbrew-install
$ ./pythonbrew-install
$ echo "source ~/.pythonbrew/etc/bashrc" >> .bashrc
$ source .bashrc
$ pythonbrew install -f 2.6.6 # なぜかtest_ioctlでこけたためforce
$ pythonbrew install -f 3.1.3 # 同上
$ pythonbrew switch 2.6.6
$ pip install virtualenv
$ pip install virtualenvwrapper
$ vi .bashrc
> export VIRTUALENV_USE_DISTRIBUTE=true
> export WORKON_HOME=~/.virtualenvs
>
> export PIP_RESPECT_VIRTUALENV=true
> export PIP_REQUIRE_VIRTUALENV=true
> export PIP_VIRTUALENV_BASE=$WORKON_HOME
>
> export VIRTUALENVWRAPPER_PYTHON=~/.pythonbrew/pythons/Python-2.6.6/bin/python
> source ~/.pythonbrew/pythons/Python-2.6.6/bin/virtualenvwrapper.sh
$ mkdir ~/.virtualenvs
$ source .bashrc
$ mkvirtualenv \
--python=~/.pythonbrew/pythons/Python-2.6.6/bin/python \
--no-site-packages \
2.6.6
(2.6.6)$ deactivate
$ pythonbrew switch 3.1.3
$ easy_install virtualenv3
$ virtualenv3 \
--python=~/.pythonbrew/pythons/Python-3.1.3/bin/python \
--no-site-packages \
$WORKON_HOME/3.1.3
(3.1.3)$ deactivate
$ pythonbrew off
$ python -V
Python 2.6.5
$ workon 2.6.6
(2.6.6)$ python -V
Python 2.6.6
(2.6.6)$ deactivate
$ workon 3.1.3
(3.1.3)$ python -V
Python 3.1.3
(3.1.3)$ deactivate
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment