2016-05-14

I usually use pyenv to manage my Python
interpreters and obtain them in whatever version I need. Another tool I
occasionally use is tox by Holger Krekel, which nicely
generates build matrices for library and python interpreter versions, that come
handy when you develop a library targeting multiple Python versions (and
dependencies).

However, until recently I didn't know how to use the two of them together.
With pyenv, I usually ended up with one python interpreter in my path, so
tox had only one interpreter to choose from, and I was missing out on tox'
selling point: testing your code over various versions of Python.

Install Multiple Python Version With Pyenv

Setting up your pyenv usually looks like this:

Now it is possible to use multiple Python versions here:

Then, tox can find interpreters, typically you will have a tox.ini in your
project that starts with something like this:

Invoking tox should now run tox with the two available Python versions, 2.7
and 3.5, skipping 3.4 unless it is installed.

Show more