DEV Community

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

Collapse
 
malwarebo profile image
Irfan

Hi, sorry for late reply.

What is the output of this command you get?

ls -l /usr/local/bin/python*

Collapse
 
monmoscovitz profile image
Mon Moscovitz

Output seem like this (Catalina - 10.15.3)
lrwxr-xr-x 1 hoangson admin 24 Feb 21 10:40 /usr/local/bin/python -> /usr/local/bin/python3.7
lrwxr-xr-x 1 hoangson admin 34 Dec 17 20:48 /usr/local/bin/python3 -> ../Cellar/python/3.7.5/bin/python3
lrwxr-xr-x 1 hoangson admin 41 Dec 17 20:48 /usr/local/bin/python3-config -> ../Cellar/python/3.7.5/bin/python3-config
lrwxr-xr-x 1 hoangson admin 36 Dec 17 20:48 /usr/local/bin/python3.7 -> ../Cellar/python/3.7.5/bin/python3.7
lrwxr-xr-x 1 hoangson admin 43 Dec 17 20:48 /usr/local/bin/python3.7-config -> ../Cellar/python/3.7.5/bin/python3.7-config
lrwxr-xr-x 1 hoangson admin 37 Dec 17 20:48 /usr/local/bin/python3.7m -> ../Cellar/python/3.7.5/bin/python3.7m
lrwxr-xr-x 1 hoangson admin 44 Dec 17 20:48 /usr/local/bin/python3.7m-config -> ../Cellar/python/3.7.5/bin/python3.7m-config

Thread Thread
 
malwarebo profile image
Irfan

It seems you already have 3.7 as a default version. See first line of the output.

Thread Thread
 
vincentfeng0101 profile image
Vincent

hello sir, I have this output with command: ls -l /usr/local/bin/python*, but when I type python --version, output is still python2. could you please help me

lrwxr-xr-x 1 djf admin 24 Mar 21 15:40 /usr/local/bin/python -> /usr/local/bin/python3.7
lrwxr-xr-x 1 djf admin 34 Jun 20 2019 /usr/local/bin/python3 -> ../Cellar/python/3.7.3/bin/python3
lrwxr-xr-x 1 djf admin 41 Jun 20 2019 /usr/local/bin/python3-config -> ../Cellar/python/3.7.3/bin/python3-config
lrwxr-xr-x 1 djf admin 36 Jun 20 2019 /usr/local/bin/python3.7 -> ../Cellar/python/3.7.3/bin/python3.7
lrwxr-xr-x 1 djf admin 43 Jun 20 2019 /usr/local/bin/python3.7-config -> ../Cellar/python/3.7.3/bin/python3.7-config
lrwxr-xr-x 1 djf admin 37 Jun 20 2019 /usr/local/bin/python3.7m -> ../Cellar/python/3.7.3/bin/python3.7m
lrwxr-xr-x 1 djf admin 44 Jun 20 2019 /usr/local/bin/python3.7m-config -> ../Cellar/python/3.7.3/bin/python3.7m-config

Thread Thread
 
malwarebo profile image
Irfan

Hey, what is your MacOS version?

Thread Thread
 
vincentfeng0101 profile image
Vincent

thank you for your reply, i have fix my problem.

Thread Thread
 
malwarebo profile image
Irfan

Awesome, glad that you fixed it.

Thread Thread
 
alt_blr_ceo profile image
Just Another Security Researcher

I'm on MacOS Catalina and it worked. Strange

Thread Thread
 
xianyang27200 profile image
xianyang27200

how did you fixed it please i have the same issue as yours 100%

Thread Thread
 
milah3 profile image
Milah3

Try the original answer and then restart your window. If that doesn't work, try it again without the last part and then restart your window:

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