pyenv https://github.com/yyuu/pyenv Module that can switch the version of python Install with Homebrew. The Ports faction looks at https://github.com/yyuu/pyenv-installer and does its best.
virtualenv A module that allows you to create an independent python environment. Omitted because it is famous. I don't use virtualenvwrapper this time.
pyenv-virtualenv https://github.com/yyuu/pyenv-virtualenv Install from github as in the README. After installation in .bash_profile
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
It is recommended to add, so let's add it.
Because it is necessary to specify the version
$ pyenv install --list | grep pypy
Get the list available at and choose the one you like
$ pyenv install pypy-2.6.1
only this. (This time somehow 2.6.1)
### Environment creation
Create an environment using pyenv-virtualenv.
#### **`$ pyenv virtualenv pypy-2.6.1 pypy-env`**
"Pypy-env" is the environment name, so use any name you like.
$ pyenv activate pypy-env
Note that it is not work on as it was with virtualenvwrapper.
Since it is slightly long, it is convenient to set an alias with a short word.
$ pyenv deactivate
Once deactivated, the deactivate mark seems to be attached to the environment,
To enter again
$ pyenv activate --force pypy-env
Must be. It seems that manual entry and exit is not expected so much,
Since it depends on the operation, it may be a good idea to add --force to the alias of activate from the beginning.
If you want to create an environment from python installed with pyenv, it is easier to use pyenv-virtualenv. (Because you don't have to worry about the path of python itself)
Especially pypy needs to include pypy-devel to install each library, If you create it from pyenv-virtualenv, it seems to have pypy-devel built-in, so it's very easy. (By the way, pypy-devel is sober because if the C compiler doesn't match, an error will occur during installation.)
However, virtualenvwrapper is better for the convenience of using it, so if you don't use multiple python versions properly with pyenv, virtualenvwrapper seems to be good.
Recommended Posts