- Install the following
# install pyenv using brew if not already installed
brew install pyenv
brew install openssl readline sqlite3 xz zlib
# Install python 3.8.13
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.8.13
NOTE: Python 3.8.13 supports Mac M1 out of the box.
In the same way as above, we could install Python 3.9 and 3.10. Also I didnt find any issues in installing Python 3.7.13 as well.
- This requires applying patch. Command looks like below.
# Before using the command just find out the correct link to the path
# https://github.com/Homebrew/formula-patches/tree/master/python
pyenv install --patch 3.8.12 <<(curl -sSL https://raw.githubusercontent.com/Homebrew/formula-patches/113aa84/python/3.8.3.patch\?full_index\=1)
This is not recommended but I came across this as a technique to install Python 3.8.12 or earlier minor versions of 3.8. This uses the GCC compiler.
brew install gcc
CC="$(brew --prefix gcc)/bin/gcc-11" PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="openssl@3" pyenv install 3.8.12
But there might be issues when we have to use installed packages. I havent used this technique, just documenting it incase I might require in the future.