DEV Community

Discussion on: How to set Python3 as a default python version on MacOS?

Collapse
 
rayahm24 profile image
rayahm24

Hey Irfan, Installed homebrew and did all the steps but it still says that the version is 2.7. 16
This is basically the code I got.

Rayyans-Air:~ rayyanahmed$ python --version
Python 2.7.16
Rayyans-Air:~ rayyanahmed$ brew link python@3.8
Linking /usr/local/Cellar/python@3.8/3.8.4...
Error: Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
rm '/usr/local/bin/2to3'

To force the link and overwrite all conflicting files:
brew link --overwrite python@3.8

To list all files that would be deleted:
brew link --overwrite --dry-run python@3.8
Rayyans-Air:~ rayyanahmed$ ls -l /usr/local/bin/python*
lrwxr-xr-x 1 rayyanahmed admin 26 Jul 21 11:36 /usr/local/bin/python -> /usr/local/bin/python3.8.3
lrwxr-xr-x 1 root wheel 69 Jul 19 17:42 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3
lrwxr-xr-x 1 root wheel 76 Jul 19 17:42 /usr/local/bin/python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3-config
lrwxr-xr-x 1 root wheel 71 Jul 19 17:42 /usr/local/bin/python3.8 -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x 1 root wheel 78 Jul 19 17:42 /usr/local/bin/python3.8-config -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
Rayyans-Air:~ rayyanahmed$ ln -s -f /usr/local/bin/python3.8.3
Rayyans-Air:~ rayyanahmed$ ln -s -f /usr/local/bin/python3.8.3
Rayyans-Air:~ rayyanahmed$ python --version
Python 2.7.16