loading...

re: How to set Python3 as a default python version on MacOS? VIEW POST

FULL DISCUSSION
 

I have followed all the steps but python --version gives Python 2.7.16 as output. Please help.

ls -l /usr/local/bin/python*
lrwxr-xr-x 1 apoorveesinha admin 24 Mar 30 04:57 /usr/local/bin/python -> /usr/local/bin/python3.7
lrwxr-xr-x 1 apoorveesinha admin 34 Mar 30 04:55 /usr/local/bin/python3 -> ../Cellar/python/3.7.7/bin/python3
lrwxr-xr-x 1 apoorveesinha admin 41 Mar 30 04:55 /usr/local/bin/python3-config -> ../Cellar/python/3.7.7/bin/python3-config
lrwxr-xr-x 1 apoorveesinha admin 36 Mar 30 04:55 /usr/local/bin/python3.7 -> ../Cellar/python/3.7.7/bin/python3.7
lrwxr-xr-x 1 apoorveesinha admin 43 Mar 30 04:55 /usr/local/bin/python3.7-config -> ../Cellar/python/3.7.7/bin/python3.7-config
lrwxr-xr-x 1 apoorveesinha admin 37 Mar 30 04:55 /usr/local/bin/python3.7m -> ../Cellar/python/3.7.7/bin/python3.7m
lrwxr-xr-x 1 apoorveesinha admin 44 Mar 30 04:55 /usr/local/bin/python3.7m-config -> ../Cellar/python/3.7.7/bin/python3.7m-config
lrwxr-xr-x 1 root wheel 71 Mar 30 04:37 /usr/local/bin/python3.8 -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
lrwxr-xr-x 1 root wheel 78 Mar 30 04:37 /usr/local/bin/python3.8-config -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8-config
apoorveesinha@Apoorvees-Air ~ % ln -s -f /usr/local/bin/python3.7 /usr/local/bin/python
apoorveesinha@Apoorvees-Air ~ % python --version

Python 2.7.16
apoorveesinha@Apoorvees-Air ~ % pip3 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

 

Did you check after starting a new terminal session?

 

Yes, I did.
Moreover, I tried following tedro's method above in the comment section.. but I don't know how the path is different ...Although this method worked but will that path create any problem later on?
On my mac
which pip results in
/usr/local/bin/pip
instead of
/Library/Frameworks/Python.framework/Versions/3.8/bin/pip

Last login: Thu Apr 16 18:09:08 on ttys000
apoorveesinha@Apoorvees-Air ~ % python --version
Python 2.7.16
apoorveesinha@Apoorvees-Air ~ % python3 --version
Python 3.8.2
apoorveesinha@Apoorvees-Air ~ % pip3 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
apoorveesinha@Apoorvees-Air ~ % pip3 install --upgrade pip
Collecting pip
Downloading files.pythonhosted.org/packages/54... (1.4MB)Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-20.0.2
apoorveesinha@Apoorvees-Air ~ % which pip
/usr/local/bin/pip
apoorveesinha@Apoorvees-Air ~ % which pip
/usr/local/bin/pip
apoorveesinha@Apoorvees-Air ~ % sudo ln -s -f /usr/local/bin/python3.8 /usr/local/bin/python
Password:
apoorveesinha@Apoorvees-Air ~ %

close/open terminal

apoorveesinha@Apoorvees-Air ~ % python --version
Python 3.8.2
apoorveesinha@Apoorvees-Air ~ % python3 --version
Python 3.8.2

Please help!

code of conduct - report abuse