How to create a virtual environment when using homebrew + pyenv-virtualenv. Since it uses homebrew, it is for MacOS.
There are already many similar materials, but I have created my own memos.
If you want to install pyenv-virtualenv and its wrapper, you can easily install it by using brew as follows.
% brew install pyenv-virtualenv
% brew install pyenv-virtualenvwrapper
If you are using homebrew-file, do as follows.
% brew file brew install pyenv-virtualenv
% brew file brew install pyenv-virtualenvwrapper
The following cautions will be displayed during installation, so set them later.
To enable shims and autocompletion add to your profile:
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
To use Homebrew's directories rather than ~/.pyenv add to your profile:
export PYENV_ROOT=/usr/local/var/pyenv
Set the environment.
% vi .bash_profile
I will add this content.
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
Enable the .bash_profile setting.
% source .bash_profile
Install python using pyenv. Here, I installed Python 3.3.6 as an example.
% pyenv install 3.3.6
Downloading Python-3.3.6.tgz...
-> https://yyuu.github.io/pythons/0a58ad1f1def4ecc90b18b0c410a3a0e1a48cf7692c75d1f83d0af080e5d2034
Installing Python-3.3.6...
(The following is omitted)
%
If PYENV_ROOT is not set, it will be installed under ~ / .pyenv / shims /.
Since I installed python3.3.6 earlier, I will use this to create a virtual environment with the name "sandbox336".
% pyenv virtualenv 3.3.6 sandbox336
Tips
Check what can be installed with pyenv as follows.
% pyenv install -l
If pip uses ~ / .. pyenv / shims / pip, install it with the pip command.
% which pip
→ pip~/.pyenv/shims/Looking at pip
% pip install django
You can uninstall it as you installed it with pyenv.
% pyenv uninstall sandbox336
% pyenv uninstall 3.3.6
http://qiita.com/maosanhioro/items/47a52f96fefba7126f9b
Recommended Posts