Download the new python on MacOS but still got the old version when asking for python version

If you have installed python 3 (check it by running python3 --version), you can set python3 as a default python version by creating a symbolic link.

run ls -l /usr/local/bin/python* to see where all versions are installed.

lrwxr-xr-x  1 root  wheel  69 May 10  2019 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3
lrwxr-xr-x  1 root  wheel  76 May 10  2019 /usr/local/bin/python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3-config
lrwxr-xr-x  1 root  wheel  71 May 10  2019 /usr/local/bin/python3.7 -> ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
lrwxr-xr-x  1 root  wheel  78 May 10  2019 /usr/local/bin/python3.7-config -> ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7-config
lrwxr-xr-x  1 root  wheel  72 May 10  2019 /usr/local/bin/python3.7m -> ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m
lrwxr-xr-x  1 root  wheel  79 May 10  2019 /usr/local/bin/python3.7m-config -> ../../../Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7m-config

The output is like above, now you just need to choose the version you want from the ones which end with ...python3.X not ...-config or ...python3.Xm, and create a symbolic link to it.

For example, you have chosen python3.7 to run as a default version, now it’s time to create the symbolic link by running:

ln -s -f /usr/local/bin/python3.7 /usr/local/bin/python

now if you run python --version its output should be 3.7

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top