Skip to content
Advertisement

How to downgrade python version from 3.8 to 3.7 (mac)

I’m using Python & okta-aws tools and in order to fetch correct credentials on aws I need to run okta-aws init. But got an error message of Could not read roles from Okta and the system prompted that"Your Pipfile requires python_version 3.7, but you are using 3.8.3 (/usr/local/Cellar/o/1.1.4/l/.venv/bin/python).

I’ve tried to search all the Pipfiles on the mac and it seems that the Pipflie under my ~/Pipfile and /usr/local/Cellar/python@3.8/3.8.3_2/libexec/bin/Pipfile all have the same python version of 3.8, while the Pipfile under my /usr/local/Cellar/okta-aws-tools/1.1.4/libexec/Pipfile has required python_version = 3.7.

I’ve been struggling with this for a while and really not sure how I can fix this.

Advertisement

Answer

Consider installing pyenv with Homebrew on macOS

JavaScript

OR Clone the repository to get the latest version of pyenv

JavaScript

Define your environment variables (For a recent MacOS you may want to replace ~/.bash_profile with ~/.zshrc as that is the default shell)

JavaScript

Restart your shell so the path changes take effect

JavaScript

Verify the installation and check the available python versions

JavaScript

Install the required python version

JavaScript

Set it as your global version after installation

JavaScript

eval pyenv path

JavaScript

Verify your current python version the system is using

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement