1

Hi I cannot seem to understand why even though I just installed Python 3.9.5 (from here https://www.python.org/downloads/), the python3 command runs python 3.8.2 on the terminal, shown below.

This is my first time installing python on my Mac (macOS Big Sur).

MacBook-Air ~ % python --version
Python 2.7.16
MacBook-Air ~ % python3 --version
Python 3.8.2

How can I run what I actually installed, which is python3.9.5?
I appreciate your help.

2

1 Answer 1

2

You should remove the current link and add a new symbolic link

unlink /usr/local/bin/python
ln -s /usr/local/bin/python3.9 /usr/local/bin/python

If you also want to be able to run Python 3.9.5 by calling python3 you can do so either as above or by updating your bash profile.

Inside ~/.bash_profile simply add the following line:

alias python3='/usr/local/bin/python3.9'

and finally reload it

source ~/.bash_profile

You should now get

python3 --version
Python 3.9.5
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you. But I don't understand why it run python 3.8 when I didn't even install this.. does it come embedded with python 3.9?
@bisuke I assume you already had Python 3.8 installed.
Thank you. For the first solution I got an error on terminal "unlink: /usr/bin/python: Operation not permitted". But I tried the second one - I edited my .zprofile instead and it worked. !

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.