Skip to content

Instantly share code, notes, and snippets.

@td72
Last active April 11, 2017 10:47
Show Gist options
  • Save td72/1d16b213360be2ca907efa7ecf43d9ce to your computer and use it in GitHub Desktop.
Save td72/1d16b213360be2ca907efa7ecf43d9ce to your computer and use it in GitHub Desktop.
virtualenvとdirenvによるpython環境構築 ref: http://qiita.com/TD72/items/308fdb8032d2db2f042b
layout python $(pythonz locate 3.6.0)
$ curl -kL https://raw.github.com/saghul/pythonz/master/pythonz-install | bash
$ echo '[[ -s $HOME/.pythonz/etc/bashrc ]] && source $HOME/.pythonz/etc/bashrc' >> $HOME/.bashrc
$ exec $SHELL
$ pythonz list -a # インストールできるpythonの確認
$ pythonz install 3.6.0
# インストールしたpythonのリスト
$ pythonz list
$ sudo pip install virtualenv
( or $ pip install --user virtualenv)
$ mkdir -p $HOME/.virtualenvs
$ virtualenv -p $HOME/.pythonz/pythons/CPython-3.6.0/bin/python $HOME/.virtualenvs/default
$ echo ". $HOME/.virtualenvs/default/bin/activate" >> $HOME/.zshrc
$ exec $SHELL
$ go get github.com/direnv/direnv
$ cd $GOPATH/src/github.com/dirnev/direnv
$ go install
$ echo 'type direnv > /dev/null 2>&1 && eval "$(direnv hook bash)" ' >> $HOME/.zshrc
$ mkdir -p project
$ cd project
$ direnv edit .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment