bisuke
bisuke

Reputation: 331

python3 command on terminal runs python 3.8 not python 3.9

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.

Upvotes: 1

Views: 8889

Answers (1)

Giorgos Myrianthous
Giorgos Myrianthous

Reputation: 39810

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

Upvotes: 2

Related Questions