For those of you who don't want to pollute Python already installed on your mac when creating a Python development environment, this article describes how to achieve the following goals:
--Switch Python version and environment (installed pip module) for each directory --Code management of pip module
――This article uses Homebrew for the very first installation to make it as easy as possible. Please install Homebrew in advance. ――Maybe there is a cooler way. ――It is troublesome to write the confirmation method, so please check it yourself.
pyenv`` pyenv-virtualenv
with Homebrewbrew install pyenv pyenv-virtualenv
echo 'export PYENV_ROOT="${HOME}/.pyenv"' >> ~/.bash_profile
echo 'export PATH="${PYENV_ROOT}/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
source ~/.bash_profile
pyenv
pyenv install 3.5.0
pyenv virtualenv 3.5.0 hoge_env
mkdir dev_home
cd dev_home
pyenv local hoge_env
pip-tools
to manage the pip modulepip install pip-tools
mkdir requirements
vim requirements/bash.in
requirements/bash.in
mysqlclient
simple-db-migrate
See http://qiita.com/ryu22e/items/ad3f8f3df30886d23661 for how to write requirements / *. in
requirements /*.in
pip-compile requirements/base.in
pip-sync requirements/*.txt
pip-compile
.Recommended Posts