I need to install python3.4 on my OS X. Tried to do it with brew install python3 and now I have python 3.5.1. But I need py3.4.

How can I install python3.4 on my Mac?


I have done this sort of thing in two ways - however both do not coexist with homebrew although I suspect there should be a way similar to the macports one.

The first is using Macports as the package manager. There are separate ports for several python versions 2.x and 3.x currently 2.4, 2.5, 2.6, 2.7 and 3.1, 3.2, 3.3 3.4 and 3.5. For example to install 3.4 do sudo port install python34 There is also a python_select port that running it allows you to choose which version of python is run by /opt/bin/python.
Each package manager needs to run as the only package manager otherwise it will be confused with unexpected different versions of libraries and executables on its paths.

The other way is install direct from python.org This will install a python into /usr/local/bin I think this installs a python and python3 executable. The issue with Homebrew is that it assumes that things in /usr/local are installed by it and so brew doctor will report these python.org pythons and libraries as issues and as this question shows also the frameworks in /Library will be problematic.

EDIT 8/2018 *** I would now suggest using conda either miniconda or anaconda. This is another package manager but based and mainly meant for python, it also gives the equivalent of python's virtual environments and pyenv (as per other answer) and so each project can be in a different python and different libraries (Macports only switches python version for all projects)

|improve this answer|||||
  • It is easiy with brew stackoverflow.com/questions/3987683/… – Raz Jan 10 '17 at 20:12
  • 1
    @Raz that is how to install one or the other not install both and chnage between them - or else I misunderstand the answer - if it is simple please give as an answer - hopefully in a simple way – user151019 Jan 10 '17 at 22:16
  • @Mark I needed to run my project on the specific python version and google gives this answer. Since brew is mentioned in the question I would prefer to install additional python version than additional package manager. My comment was for googlers like me. – Raz Jan 11 '17 at 17:39

$ brew install python3 is equals follow

$ brew install https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb

So. if you want to install a specific version then, you must check before install.

  • Check the git history of python.rb
  • Find the version you want. Now you can use brew install with the corresponding commit hash:
    • 3.4.3_2: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/bd43f59bd50bb49242259f327cb6ac7a8dd59478/Formula/python3.rb
    • 3.5.2_3: $ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ec545d45d4512ace3570782283df4ecda6bb0044/Formula/python3.rb
    • 3.6.5_1: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

There is also: https://github.com/sashkab/homebrew-python where you can install using brew install sashkab/python/python34 and brew link python34 --force

Please note that python3.rb was renamed to python.rb at some point. Change the URL if necessary.

|improve this answer|||||
  • As an FYI: Python 3.4.3_2 is $ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/bd43f59bd50bb49242259f327cb6ac7a8dd59478/Formula/python3.rb and then python3.4 -V should work. – iwasrobbed Nov 30 '17 at 17:04
  • @iwasrobbed it's 404: Not Found at this moment – Никита Конин Jan 17 '18 at 0:12
  • This didn't install pip3. :( – Kirby Jan 27 '18 at 21:40
  • Unfortunately, the browser page for the Python 3 formula will not display. It says something about the history being too long and taking too long to generate on the page. I was tempted, but did not, clone the entire repo. – Mike Williamson May 4 '18 at 5:12
  • 7
    The file python3.rb is renamed as python.rb already. Try the other path. As FYI: Python 3.6.5_1 is $ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb – John Pang Jul 2 '18 at 9:37

For python in mac use pyenv

brew install pyenv
pyenv install <version>

To select a version

pyenv local 3.5.0

To List versions

pyenv versions


You need to export the PATH to override the default python version.

|improve this answer|||||
  • I use this installed python 3.6.6rc1 but brew still points python3 to 3.7.0. Since I'm using Heroku and Pipfile use 3.6, I use the other answer to get 3.6.5 installed (3.6.6 isn't available in GitHub, as far as I can tell). – John Pang Jul 2 '18 at 9:43

This seems like a much easier approach AND keeps away from /usr/local/bin !!


I haven't tested it, but it promises to be able to install any version (and multiple versions) of Python.

Including 3.6.6 which isn't available in the brew core as far as I can tell.

|improve this answer|||||
  • project is deprecated – lobi Oct 25 '19 at 22:58
  1. You can list all the version of python in your local

    $ ls /usr/local/bin
    $ brew ls python

  2. add alias to your myzsh or bash

    $ echo "alias python=/usr/local/bin/python3.4" >> ~/.zshrc
    $ echo "alias python=/usr/local/bin/python3.4" >> ~/.bashrc

  3. reload config

    $ source ~/.zshrc
    $ source ~/.bashrc

  4. verify the version you are using

    $ python --version

Bingo, you make it. Kindly reminder, you also need to config your pip version. ref: https://opensource.com/article/19/5/python-3-default-mac

|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .