Skip to content

Instantly share code, notes, and snippets.

@shun115
Created January 21, 2011 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shun115/789529 to your computer and use it in GitHub Desktop.
Save shun115/789529 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 2.7.2 # 同上
$ pythonbrew install -f 3.2.2 # 同上
$ pythonbrew install 2.7.2 --configure="--with-zlib=/usr/include"
$ pythonbrew switch 2.7.2
$ 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.7.2/bin/python
> source ~/.pythonbrew/pythons/Python-2.7.2/bin/virtualenvwrapper.sh
$ mkdir ~/.virtualenvs
$ source .bashrc
$ mkvirtualenv \
--python=/home/username/.pythonbrew/pythons/Python-2.7.2/bin/python \
--no-site-packages \
2.7.2
(2.7.2)$ deactivate
$ pythonbrew switch 3.2.2
$ easy_install virtualenv3
$ virtualenv3 \
--python=~/home/username/.pythonbrew/pythons/Python-3.2.2/bin/python \
--no-site-packages \
$WORKON_HOME/3.2.2
(3.2.2)$ deactivate
$ pythonbrew off
$ python -V
Python 2.6.5
$ workon 2.7.2
(2.7.2)$ python -V
Python 2.7.2
(2.7.2)$ deactivate
$ workon 3.2.2
(3.2.2)$ python -V
Python 3.2.2
(3.2.2)$ deactivate
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment