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 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?
For Python in macOS, use pyenv:
brew install pyenv
To install a specific Python version, run:
pyenv install <version>
To select a version for every command run with the current folder:
pyenv local 3.5.0
Note that you must update PATH in your environment to find pyenv's python3 before any other:
PATH="~/.pyenv/shims:${PATH}"
With recent version of OSX(13.X) the path is moved to /etc/paths.d/ Add a file eg: pyenvpath to /etc/paths.d/pyenvpath Add the path to that file.
To list available versions:
pyenv versions
See https://gist.github.com/Bouke/11261620 for more information.
git checkout 3.10; and configuring and building per https://devguide.python.org/setup/#compile-and-build .
– Rainy
Sep 21 '21 at 01:00
pyenv doesn't work on any major version of 3.5 on Mac OS for me. Issue is the same as: https://github.com/pyenv/pyenv/issues/1768
– Osama Dar
Sep 13 '22 at 20:41
$ 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.
brew install with the corresponding commit hash:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/bd43f59bd50bb49242259f327cb6ac7a8dd59478/Formula/python3.rb$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ec545d45d4512ace3570782283df4ecda6bb0044/Formula/python3.rbbrew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rbThere 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.
$ 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
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
https://raw.githubusercontent.com/Homebrew/homebrew-core/9b35174928/Formula/python.rb
– philraj
Jun 25 '20 at 17:51
git log master -- Formula/python.rbto see all versions.
– Cellcore
Jul 20 '20 at 00:07
Error: Calling Non-checksummed download of python@3.7 formula file from an arbitrary URL is disabled! Use 'brew extract' or 'brew create' and 'brew tap-new' to create a formula file in a tap on GitHub instead. If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
– Matt
Sep 09 '20 at 12:59
brew extract python to a stable tap on GitHub instead. (UsageError)
– ronit
May 16 '21 at 19:43
Install the required version:
% brew install python@3.7
% brew list | grep python
% brew ls python@3.7
% ls -l /usr/local/Cellar/python@3.7/3.7.8_1/bin/python3.7
Add a soft link to /usr/local/bin/:
% ln -s /usr/local/Cellar/python@3.7/3.7.8_1/bin/python3.7 /usr/local/bin/python3.7
% python3.7 -V
Create a Python virtual environment:
% python3.7 -m venv venv37
Enter the virtual environment:
% source venv37/bin/activate
Exit the virtual environment:
% deactivate
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. e,g, to select macports python 2.7 port select --set python python27
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.
From comments the similar homebrew way is given in https://stackoverflow.com/a/4158763/151019 Short answer seems to be brew switch the equivalent to port_select
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)
This seems like a much easier approach AND keeps away from /usr/local/bin !!
https://github.com/sashkab/homebrew-python
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.