Cannot `brew install` from a `bash` script

It appears this error comes from Python being misconfigured.

The answer is to brew postinstall python3.

When Googling around, I found a separate project demonstrating a similar issue.

Here is what I saw on my machine:

$ python --version
Python 2.7.10
$ brew install python
Warning: python 3.7.4 is already installed, it's just not linked
You can use `brew link python` to link this version.
$ brew postinstall python3
==> Postinstalling python
==> /usr/local/Cellar/python/3.7.4/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.4/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.4/bin/python3 -s setup.py --no-user-cfg install

After running postinstall, it didn't appear to change Python

$ python --version
Python 2.7.10

However, it did postively affect Homebrew, and allowed the script to run successfully!

$ ./install
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

Warning: gcovr 4.1 is already installed and up-to-date
To reinstall 4.1, run `brew reinstall gcovr`
gcovr 4.1

Copyright 2013-2018 the gcovr authors
Copyright 2013 Sandia Corporation
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.