Each Answer to this Q is separated by one/two green lines.
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
/usr/local/Cellar/[email protected]/3.8.3_2/libexec/bin/Pipfile all have the same python version of 3.8, while the Pipfile under my
required python_version = 3.7.
I’ve been struggling with this for a while and really not sure how I can fix this.
pyenv with Homebrew on macOS
brew update brew install pyenv
OR Clone the repository to get the latest version of
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
Define your environment variables
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile echo 'eval "$(pyenv init -)"' >> ~/.bash_profile source ~/.bash_profile
Restart your shell so the path changes take effect
Verify the installation and check the available
pyenv install --list
Install the required
pyenv install 3.7
Set it as your global version after installation
pyenv global 3.7
Verify your current
python version the system is using
I recommend you to install and use pyenv, a Python Version Management.
Once intalled pyenv, install python 3.7:
pyenv install 3.7
And then set the environment
PYENV_VERSION to version of python you want to use, on this case will be 3.7:
pyenv shell 3.7
brew only approach.
rm -rf $(brew --repository)/Library/Taps/company brew tap-new company/team brew extract [email protected] company/team --version=3.7.9 HOMEBREW_NO_AUTO_UPDATE=1 brew install company/team/[email protected] brew link --force company/team/[email protected]
This creates a local tap, extracts python 3.7.X to a formula in that local tap and then installs and links that formula
The created local tap and the new formula file can be found in