[PYTHON] pyenv-Building a pypy environment using virtualenv (MacOSX)

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.

Environment construction procedure

Install pypy

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.

Enter the environment

$ 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.

Get out of the environment

$ 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.

bonus

Which is better, virtualenvwrapper

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

pyenv-Building a pypy environment using virtualenv (MacOSX)
Build a go environment using Docker
Try using virtualenv, which can build a virtual environment for Python
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Building a virtual environment using homebrew + pyenv-virtualenv
[Python] Create a Batch environment using AWS-CDK
Building a python environment with virtualenv and direnv
Use the latest pip in a virtualenv environment
Commands for creating a python3 environment with virtualenv
Work in a virtual environment with Python virtualenv.
Build a Django development environment using pyenv-virtualenv on Mac
How to set up a Python environment using pyenv
Build a python virtual environment with virtualenv and virtualenvwrapper
Build a Python virtual environment using venv (Django + MySQL ①)
Build a Python environment on your Mac using pyenv
Build a python virtual environment with virtualenv and virtualenvwrapper
Build a Python development environment using pyenv on MacOS
Memo for building a machine learning environment using Python
Prepare Django development environment using homebrew on MacOSX Mavericks (10.9)
Build a lightweight Fast API development environment using Docker
Try using virtualenv (virtualenvwrapper)
Try using virtualenv now
Create a Python environment
Build an environment for machine learning using Python on MacOSX
Create a Python (pyenv / virtualenv) development environment on Mac (Homebrew)
Building a Jupyter Lab development environment on WSL2 using Anaconda3
Building a Python environment on a Mac and using Jupyter lab
A story that stumbled when using pip in a proxy environment
Launching a machine learning environment using Google Compute Engine (GCE)
Building a pyhon environment without using Anaconda (with easy startup)
pyenv, virtualenv Use docker to manage the environment without using
Build a Flask development environment at low cost using Docker
Until building a Python development environment using pyenv on Ubuntu 20.04
It is good to create an environment with runtime error => venv when using pyplot backends of macosx on a virtual environment created with virtualenv.