My Mac Mini M1 shipped with Python 3.8.5.
I first installed Anaconda, then downloaded Python 3.9.1 (macOS 64-bit universal2 installer), installed that and ran Update Shell Profile.command.
IDLE runs the correct version (3.9.1) however typing python3 –version at command line yields: Python 3.8.5
where python3 results in the following:
/Users/fa/opt/anaconda3/bin/python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
/usr/local/bin/python3
/usr/bin/python3
How do I get the shell to point to the most recent version (3.9.1)?
Best Answer
You can use
pyenv
to manage your python3 versions installed on your system.To install
pyenv
:You can do the following:
Open a new terminal or source your bash_profile or shell profile by:
source ~/.bash_profile
orsource ~/.zshrc
.Now to install a new version, you can check the list by:
Find the version you want to install, and install it by:
Now you will be able to see all the different python versions that you have installed by:
You can choose any of the above output as your global Python from the previous command by:
For more details see their git repo at: https://github.com/pyenv/pyenv