I have recently installed Python 3.8 for my macOS, but whenever I try to launch IDLE through terminal, the Python version is 2.7.16 instead of 3.8. I have tried to restart my Mac, but it didn't change anything.
-
1Does this answer your question? [How to set Python's default version to 3.x on OS X?](https://stackoverflow.com/questions/18425379/how-to-set-pythons-default-version-to-3-x-on-os-x) – Tomerikoo Mar 06 '21 at 11:01
-
When Python 3 came, most *nix systems, including macOS, kept 'python' for Python2 and added 'python3' for Python 3.x. Different systems will switch 'python' to the latest python as varying times over the next decade or so. I have 3.8, 3.9, and 3.10a on my Macbook so I am used to typing python3.8, etc, in Terminal. I keep IDLEs on the dock. – Terry Jan Reedy Mar 08 '21 at 14:03
1 Answers
There are several versions of the IDLE app: one for each of your Python version. If you installed your Python trough the Mac OS app, you will have an IDLE for Python3 in the Applications folder.
However, if you have not installed your Python with pyenv
or smiliar, aliases and simlinks will be the pointing to the system Python, which is the one you see.
So at this point, you both have idle2.7
and idle3.8
. But your python
and idle
commands will point towards Python2.7
Just call the correct idle with idle3
and don't forget to use python3
when you need to use Python3.8 from the terminal.
Note: it is not a good practice to change your python
alias, as some system apps rely on Python2.7.5, so the best way for you to deal with this if your really want to keep typing idle
and python
instead of idle3
and python3
is either to create a custom alias or to reinstall your python using pyenv

- 2,282
- 3
- 10
- 24