Sign up ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I'm adding Python 3.x support to my open-source project and want to add both Py32 and Py33 test environments to my tox.ini. I already have Py26 and Py27 tox environments that work fine and I just installed Python 3.3 from homebrew and got the Py33 tox environment working nicely.

The problem seems to be that homebrew doesn't have an obvious way to install both 3.3 and 3.2 and a somewhat extended Googling did not yield an answer.

What's the best way to do this that won't lead me into trouble further down the road? I'm happy to build from source if that's the best solution, have done that before with good success but don't want to break out the axe if a pocket knife will get the job done :)

I'm running OS X 10.8.4

share|improve this question

2 Answers 2

up vote 1 down vote accepted

The problem seems to be that homebrew doesn't have an obvious way to install both 3.3 and 3.2 and a somewhat extended Googling did not yield an answer.

— Try the following solution to install multiple Python 3.x versions with brew:

  1. Make sure you don't have any Python 3.x installed:

    brew uninstall python3

  2. Then cd into your brew directory, this is /usr/local normally:

    cd /usr/local

  3. Then list all the available Python 3.x versions in Homebrew:

    brew versions python3

  4. Then follow installation instructions for required Python versions from here.

share|improve this answer
Sweet! This gets it done :) Now I can use tox to test with all of Python 2.6, 2.7, 3.3, and 3.4 :) – scanny Jun 23 '14 at 0:27
You're welcome. :) – Dmitry Cheremushkin Jun 23 '14 at 0:32
brew versions has been removed – wim Jun 9 at 4:53

The installation instructions referenced by @dimitry-cheremushkin have been changed and recommend using pyenv instead. Tox and Pyenv can be used together like this:

First we ensure we have pyenv installed:

$ brew update
$ brew install pyenv

Then we install all the needed python versions with pyenv. This might take time. See for available versions.

$ pyenv install 2.6.9 && pyenv ... && pyenv install 3.5.0

In the directory of our, let us run pyenv local ... as below. It will create .python-version file that stores the versions to be used.

$ pyenv local 2.6.9 2.7.10 3.2.6 3.3.6 3.4.3 3.5.0

So, pyenv installed the Python distributions to a dir ~/.pyenv/shims. To let them to be found instead default Python, the dir must be prepended to the PATH environment variable. Even though more permanent solutions exist, the following does the trick for one terminal session:

$ eval "$(pyenv init -)"
$ echo $PATH

The following has been recommended to be run to ensure the shims have correct packages:

$ pyenv rehash

Now, let us assume the following tox.ini:

envlist = py26,py27,py30,py31,py32,py33,py34,py35

Finally we can run tox in all the environments:

$ tox
py26: commands succeeded
py27: commands succeeded
py30: commands succeeded
py31: commands succeeded
py32: commands succeeded
py33: commands succeeded
py34: commands succeeded
py35: commands succeeded
congratulations :)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.