Install Python 3.8.0 and IDLE
on macOS and Microsoft Windows

Before you begin, create a folder in which to store the Python scripts that you will create.

  1. On macOS, I named the folder /Users/myname/python
  2. On Linux, I named the folder ~/python
    (The ~ is a tilde.)
  3. On Microsoft Windows, I named the folder C:\Users\Myname\python

1. macOS

Preliminaries: open a macOS Terminal window

Open a new macOS Terminal window by launching
Finder → Applications → Utilities → Terminal.app
If you want, you can then make the Terminal’s font bigger by pulling down
Terminal → Preferences… → Profiles → Text → Font

Install Python 3 and IDLE.

To see if you already have Python and IDLE, look in the Applications folder for Python. If you don’t have it, go to
https://www.python.org/downloads/
and press the yellow “Download Python 3.8.0” button to download the file python-3.8.0-macosx10.9.pkg into your Downloads folder. (This file requires macOS 10.9 or later; or you can download a file for 32-bit versions of macOS.) Double-click on this file agree to the terms of the license, select the disk where you want to install the Python software (accept the default it offers you), and enter your Apple password. When it’s done, go to your /Applications/Python 3.8 folder and double-click on Install Certificates.command. If it says “You should consider upgrading via the 'pip install --upgrade pip' command.”, say

pip3 install --upgrade pip

See if you can launch IDLE.

Launch
Finder → Applications → Python 3.8 → IDLE.app.
Type the words in italics.

Python 3.8.0 Shell
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> 10 + 20
30

>>> quit()
Your program is still running!
Do you want to kill it?
OK

If you plan on using IDLE a lot, drag it into your Mac’s dock.

See if you can run python3, pydoc3, and pip3 from the Terminal window.

Close the Mac Terminal window and open a new one. Type the following commands in to verify that you now have Python 3.8.0. You can run the program python3 without having to tell the computer where to find python3, because this program is in one of the directories (namely, /Library/Frameworks/Python.framework/Versions/3.7/bin) in your PATH. (To see if you have Python 2, say python instead of python3.) Press q to quit pydoc3.

echo $PATH | tr : '\n' | cat -n
     1  /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
     2  /usr/local/bin
     3  /usr/bin
     4  /bin
     5  /usr/sbin
     6  /sbin

which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3

python3 --version
Python 3.8.0

python3 --version --version
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)
[Clang 6.0 (clang-600.0.57)]

python3 --help

python3
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)
[Clang 6.0 (clang-600.0.57)]
Type "help", "copyright", "credits" or "license" for more information.
>>> 10 + 20
30
control-d

pydoc3 topics
pydoc3 modules
pydoc3 -b

pip3 --version
pip 19.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
pip3 --help
pip3 list

cat ~/.zprofile
# Setting PATH for Python 3.8
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH

exit

2. Microsoft Windows

Preliminaries: open a Microsoft Windows Command Prompt window

Open the black Windows Command Prompt window. To get there, press the Windows Start button in the lower left corner of the screen. In the box where it says “Search programs and files” type cmd.exe. Type (or paste in) the following commands in italics into the black window. In Microsoft Windows, the directories in your Path are separated by semicolons. One of those directories should be C:\windows. (Scroll this page to see it.)

help date

date /T
Thu 06/15/2017

path
PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\;C:\ProgramFiles (x86)\Toshiba\Bluetooth Toshiba Stack\sys\x64\;C:\Users\Mark\Development\adt-bundle-windows-x86_64-20140702\sdk\tools;C:\Users\Mark\Development\adt-bundle-windows-x86_64-20140702\sdk\platform-tools;C:\Program Files (x86)\QuickTime\QTSystem\

dir C:\windows\py.exe     You don’t have the program py.exe yet.
File Not Found

exit

Install Python 3 and IDLE.

To see if you already have Python, press the Microsoft Windows Start button in the lower left of the screen and search for Python. If you don’t have Python,

I used the following directions to install Python 3 and IDLE on my Windows 7 Home Premium.

Go to https://www.python.org/downloads/ and press the yellow “Download Python 3.8.0” button.

Do you want to run or save python-3.8.0.exe (29.0 MB) from python.org?
Save
Running security scan…
The python-3.8.0.exe download has completed.
Run
Install Python 3.8.0 (32-bit)
Select “Install Now”.
C:\Users\Myname\AppData\Local\Programs\Python\Python36-32 (make a note of this!)
To continue, type an administrator password, and then click Yes.
Setup Progress
Setup was successful.
Close.

See if you can launch IDLE.

Press the Windows Start button.
Start → All Programs → Python 3.7 → IDLE (Python 3.7 32-bit)
Type the words in italics.

Python 3.7.3 Shell
Python 3.7.3 (v3.6.2:69c0db5, Jul 16, 2017, 20:11:06) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 10 + 20
30

>>> quit()
Your program is still running!
Do you want to kill it?
OK

See if you can run C:\windows\py.exe from the Windows Command Prompt.

Open the black Windows Command Prompt window. Type the following commands in italics to verify that you now have Python 3.7.4. Type your name instead of Myname. You can run the program py.exe without having to tell the computer where to find py.exe, because this program is in one of the directories (namely, C:\Windows) in your path. You can say py instead of py.exe.

Also check the association for the filename extension .py.

C:\Users\Myname>dir C:\Windows\py.exe
07/16/2017  05:55 PM           889,496 py.exe

C:\Users\Myname>py.exe -V
Python 3.7.4

C:\Users\Myname>py -V
Python 3.7.4

C:\Users\Myname>py
Python 3.7.3 (v3.6.2:69c0db5, Jul 16 2017, 20:11:06) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
10 + 20
30
control-z enter

C:\Users\Myname>assoc /?
Displays or modifies file extension associations

C:\Users\Myname>assoc .py
.py=Python.File

C:\Users\Myname>ftype Python.File
Python.File="C:\windows\py.exe" "%L" %*

C:\Users\Myname>py.exe -m pip --version
pip 9.0.1 from C:\Users\Myname\AppData\Local\Programs\Python\Python36-32\lib\site-packages (python 3.7)

C:\Users\Myname>py.exe -m pip help

C:\Users\Myname>exit

Later, we’ll put append name of the directory that holds your Python scripts to your PATH variable.

3. Linux

This course is hosted on the Fedora 20 (Heisenbug) Linux machine oit2.scps.nyu.edu

Run IDLE.

To run IDLE on oit2.scps.nyu.edu and see its window on your Mac, download XQuartz from https://www.xquartz.org/ onto your Mac. Double-click on the package XQuartz.pkg to install it. Then go to
Finder → Applications → Utilities
and launch XQuartz.app. In XQuartz.app, pull down
Applications → Terminal
and the little XQuartz Terminal window will appear. In the XQuartz Terminal window, type the words in italics.

ssh -Y yourname@oit2.scps.nyu.edu
password:

echo $DISPLAY
localhost:10.0

idle3.7 &
Python 3.7.2 Shell
Python 3.7.2 (default, Jan  2 2019, 11:27:14)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux
Type "help", "copyright", "credits" or "license()" for more information.
>>> 10 + 20
30
>>> quit()
Your program is still running!
Do you want to kill it?
OK

Run Python from the Linux shell.

which python3
/usr/local/bin/python3

python3 --version
Python 3.7.2

python3 -c 'print(10 + 20)'
30