Python 3.6 Download Mac Os

Python 3 download for mac

Install Python3 on a Mac

Written by Art, June 18, 2017

Prerequisites for installing Python3 on Mac

Gpg -verify Python-3.6.2.tgz.asc Note that you must use the name of the signature file, and you should use the one that's appropriate to the download you're verifying. (These instructions are geared to GnuPG and Unix command-line users.).

Install Xcode

Xcode is Apple's Integrated Development Environment (IDE). You might already have Xcode on your Mac. If not, you can get Xcode from Apple appstore.

Xcode

Install Brew

Download Python For Mac Os

Homebrew installs the stuff you need. Homebrew is a package manager for Mac OS

Step 1. Launch Terminal.

Python

Go to Launchpad – Other – Terminal

Step 2. Install HomeBrew

Install Python3 with Brew

Enter brew command into terminal

brew install python3

Python 3.6 Download Mac Os 10.13

Optional, PATH environment

Set up PATH environment variable, if you used HomeBrew to install Python3, then HomeBrew already added PATH.

Do not change PATH environment if you can launch python3 from terminal.

Add the following line to your ~/.profile file

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

Usually your Python installation directory looks like this, add it to your PATH

PATH='/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}'

After running brew update; brew upgrade, brew updated python to version 3.7.x.x. When my code stopped working, I noticed that some of the 3rd party packages i use are not compatible Python 3.7.x.x yet. So i decided to revert to Python 3.6.5_1 the version that i am certain i will not have any troubles with.

I failed after trying to to revert to an older version using the usual method: brew install python@3.6.5_1 or: brew install python@3.6.5 or even: brew install python@3.6

After spending some time testing solutions i found the following posts that explained the situation to a great extent:

Install Python 3.6 On Mac

  • https://github.com/tensorflow/tensorflow/issues/25093

So, without further due, here is the solution:

First let’s ask brew to remove the links to the most recent python version, that brew installed automatically:

Then let’s install the version 3.6.5_1 by directing brew to the suitable commit of the python brew formula on the Homebrew formulae repository. The commit ID for Python 3.6.5_1 Formula is: f2a764ef944b1080be64bd88dca9a1d80130c558. To avoid the issue with circular dependencies the flag –ignore-dependencies must be used:

Then let’s ask brew to create the links to the freshly installed version of python:

Python 3.6 Download

Now could create a python 3.6.5_1 virtual environment to use it in a specific project, and then let brew update your python installation. To achieve that result with the module venv use the --copies option to make sure copies of the binaries (python, pip, etc.) were copied to the virtual environment folder. If --copies was not specified, venv will create symbolic links to the python binaries, and that means you will lose the correct version of python once brew upgrades the python binaries.

Alternatively, you could stop brew from automatically upgrading python when running brew upgrade. You simply have to tell brew that you don’t want to upgrade the python formula in the future:

You can allow brew to upgrade python by simply reverting the previous action:

Install

I hope this post was useful!