How to downgrade Homebrew Python to 3.6

A new Py­thon ver­sion has been re­leased, but Tensor­Flow does not yet sup­port it on ac­count of a break­ing change with async and await be­ing made re­served keywords. Homebrew has up­dated their de­fault py­thon ver­sion to 3.7, and it is quite dif­fi­cult to find out how to down­grade. To save head­aches, the an­swer is that you need to in­stall a the py­thon for­mula from a ver­sion prior to the up­date:

$ brew unlink python
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/e128fa1bce3377de32cbf11bd8e46f7334dfd7a6/Formula/python.rb
$ brew switch python 3.6.5

You can now python -m pip install tensorflow to your hearts con­tent.

AI researcher specializing in compilers and code optimization.