0% found this document useful (0 votes)
21 views

4 - Writing Our First Python Code

This document discusses how to run Python 3 instead of an older default version of Python that may be installed on macOS. It recommends running "python3" instead of just "python" to use Python 3, and provides instructions for permanently changing the default Python version to 3 using symbolic links.

Uploaded by

Saa Nia
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

4 - Writing Our First Python Code

This document discusses how to run Python 3 instead of an older default version of Python that may be installed on macOS. It recommends running "python3" instead of just "python" to use Python 3, and provides instructions for permanently changing the default Python version to 3 using symbolic links.

Uploaded by

Saa Nia
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Running Python 3 as a Default (on macOS)

In this course, we will use Python 3.x. Try running python3 instead of python in case


you're using an older version by default (see below for additional information).

You can see the version of Python that's being used for the REPL (command line) or to
execute your files when running python --version . 

If this says Python 2.7 (or anything else but some version starting with 3 - e.g. 3.5), you
can run Python 3.x by executing python3 instead of just python .

This is especially important on macOS, where you already got Python 2.7 pre-
installed. To NOT use that, run python3 instead of python .

Alternatively, you change the Python version used by default as discussed and described
in this thread: https://stackoverflow.com/questions/18425379/how-to-set-pythons-default-
version-to-3-3-on-os-x

You essentially can run these two commands to change the default version being used:

unlink /usr/local/bin/python
ln -s /usr/local/bin/python3.6 /usr/local/bin/python

Thereafter, you can just run python to use Python 3.x

You might also like