Installing Python 3 On Windows 10

Note: Any reasonably recent version of Python is acceptible for this course. If you have a verison of Python 3.x on your computer already you should be able to use it for this class.

Please download and install Python 3.x from: http://www.python.org/download/

As you install Python, make sure to check the "Add Python 3.5 to PATH" so that you can type python at the command line prompt to run Python.


Installing the Pycharm Editor

Please download and install Pycharmfrom this site: https://www.jetbrains.com/pycharm/


Windows Command Line Notes

When the command line starts up, you are in your "home" directory. Your home directory is different for each of the operating systems. In each of these examples, your logged in account should be used instead of csev.


    Windows XP:             C:\Documents and Settings\csev
    Windows Vista:          C:\Users\csev
    Windows 7:              C:\Users\csev
    Windows 10:             C:\Users\csev
The command line prompt usually includes some clue as to where you are in the folder structure on your hard drive.

If you want to really figure out where you are, use the cd command with no parameters

    C:\Users\csev> cd
    C:\Users\csev


Where can you go?

Generally the first thing you want to do when you open a command line interface is to navigate to the right folder. Say you wanted to run a file from your desktop. The command is cd Desktop to get into the folder that is your Desktop. You can use the dir command to see which files are in the current directory and the cd .. command to go "up" a directory

Nifty Trick: On the cd command, you can partially type a folder name like Desktop and then press the TAB key and the system will auto-complete the folder name if you have typed enough that the system can accurately guess what you mean to type.

If you get Lost...

If you can't figure out what folder you are in and/or cannot figure out how to get to the folder you want to get to - simply close and re-open the Command Line / Terminal window. You will be back to your "home" directory - so you can start from a known location.

Some Cool Hints on the Windows Command Line Interface

If you click on the little icon in the upper-left of the command prompt window and select Preferences - you can set many things about the command line - probably the most important is to set the Command History Buffer Size to be 999.


Running Your Python Program in the Command Line

To run your program in the command line you type at the command line prompt. Windows knows that files wthat end with a ".py" suffix are Python programs.

    python firstprog.py

or

    firstprog.py

Where firstprog.py is the name of the file containing your Python program. Make sure to use the cd command to be in the correct directory that contains your program file(s).

You can run your program over and over again in the command window. Hint: You can use the up-arrow key to scroll back through previous commands and re-execute them by pressing enter. This allows you to quickly edit and rerun your program to make and test changes.


Getting started with Python on a Macintosh

Python 2 and Python 3 are already installed on Macintosh OS/X operating system so all you need to add is a programmer text editor.

Starting Terminal on Macintosh OS/X

The Terminal program on Macintosh is kind of buried under Macintosh HD -> Applications -> Utilities -> Terminal

There are several shortcuts that you might find helpful. You can go into the upper-right of your screen and click on the Spotlight search button and type terminal and you can execute Terminal from the pop-up list of items.

You can get Terminal to stay in your dock once terminal is launched by clicking and holding on the Terminal icon in the dock and then selecting "Keep in Dock". Then you can quickly launch Terminal by clicking on the icon in the dock.

Where Are You?

When the command line starts up, you are in your "home" directory. In each of these examples, your logged in account should be used instead of csev.

    Macintosh Home Directory: 		/Users/csev

The command line prompt usually includes some clue as to where you are at in the folder structure on your hard drive. If you want to really figure out where you are, on Macintosh use the pwd command.

    udhcp-macvpn-624:~ csev$ pwd
    /Users/csev
    udhcp-macvpn-624:~ csev$ 

Where can you go?

Generally the first thing you want to do when you open a command line interface is to navigate to the right folder. Say you wanted to run a file from your desktop. The command is cd Desktop

    udhcp-macvpn-624:~ csev$ pwd
    /Users/csev
    udhcp-macvpn-624:~ csev$ cd Desktop
    udhcp-macvpn-624:Desktop csev$ pwd
    /Users/csev/Desktop
    udhcp-macvpn-624:Desktop csev$

Nifty Trick: On the cd command, you can partially type a folder name like Desktop and then press the TAB key and the system will auto-complete the folder name if you have typed enough that the system can accurately guess what you mean to type.

Going Backwards (or Upwards)

You can change directory to the parent folder (the folder "above" the folder you are in using the cd .. command. It just says "go up one".

    udhcp-macvpn-624:Desktop csev$ pwd
    /Users/csev/Desktop
    udhcp-macvpn-624:Desktop csev$ cd ..
    udhcp-macvpn-624:~ csev$ pwd
    /Users/csev
    udhcp-macvpn-624:~ csev$ 

If you get Lost...

If you can't figure out what folder you are in and/or cannot figure out how to get to the folder you want to get to "home" simply close and re-open the Command Line / Terminal window.

What Files/Folders are Here?

You can list the contents of the current directory using the ls -l command.

    udhcp-macvpn-624:Desktop csev$ pwd
    /Users/csev/Desktop
    udhcp-macvpn-624:Desktop csev$ ls -l 
    total 8
    -rw-r--r--  1 csev  staff   15 Sep 16 15:17 firstprog.py
    udhcp-macvpn-624:Desktop csev$ 

Running Your Python Program in the Terminal

Start the Terminal program, navigate to the proper directory and type the following command:

    python3 firstprog.py

This loads the Python 3 interpreter and runs firstprog.py, showing the program output and/or errors in the Terminal window.

Some Cool Hints on The Macintosh Terminal Program

You can scroll back through previous commands by pressing the up and down arrows and re-execute commands using the enter key. This can save a lot of typing. If you like keeping your screen uncluttered, you can clear the scroll back buffer by pressing the Command key and the K key at the same time.

The first task is to work through the installation steps including installing Python and text editor.

Views
46 Total Views
1 Members Views
45 Public Views
Actions
0 Likes
0 Dislikes
0 Comments
Share on Social Networks
Share Link
Use permanent link to share in social media
Share by mail

Please login to share this webpage by email.