I want to change the default version of my Python on Mac from Python2 to Python3. However, when I try to do that, it says that the permission is denied. Here is what I have tried:
ls -l /usr/local/bin/python*
The output was:
lrwxr-xr-x 1 root wheel 69 Jun 21 10:41 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3
lrwxr-xr-x 1 root wheel 76 Jun 21 10:41 /usr/local/bin/python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3-config
lrwxr-xr-x 1 root wheel 71 Jun 21 10:41 /usr/local/bin/python3.9 -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9
lrwxr-xr-x 1 root wheel 78 Jun 21 10:41 /usr/local/bin/python3.9-config -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9-config
Then, I tried:
ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python
However, this is what appeared:
ln: /usr/local/bin/python: Permission denied
How should I fix this problem?
In order to change the default version, you can simply type the below command in the terminal:
alias python=python3