Python For Windows Primer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Getting Started with Python Programming for Windows

Users
Installation of Python & SciPy Libraries

• Get the latest version of Python installed on your system if it is not already. There are
many good ways to do this. See https://www.scipy.org/install.html
• Install the following SciPy Libraries using pip (see below):
o scipy
o numpy
o matplotlib
o pandas
o sklearn
• python -m pip install --user numpy scipy matplotlib pandas sklearn

Setting up the Environment

• Use File Explorer to create a folder where you plan to store your Python programs. You
can use a different folder for each assignment.
• In the box at the top where the file path is shown, right click and click on “Copy address
to text”.
• Click on Start >> Windows System >> Command Prompt
• A Command Prompt window should open.
• Type “cd /d”, then a space, then Ctrl-V. This will paste the folder (i.e., directory) you
made to store your Python programs in. The command line should look something like
this:

V:\>cd /d D:\KU\Spring 2020 (690)\Assignment 1\PythonProgramsAssgn1

• Press Enter. This will change the Command Prompt environment to the directory with
your Python programs.
• Type “dir”. This will list your Python program files. There should be nothing there since
you haven’t created a program yet. It should look something like this:

D:\KU\Spring 2020 (690)\Assignment 1\PythonProgramsAssgn1>dir


Volume in drive D is USB20FD
Volume Serial Number is EFEE-5C69

Directory of D:\KU\Spring 2020 (690)\Assignment 1\PythonProgramsAssgn1

01/09/2020 11:22 AM <DIR> .


01/09/2020 11:22 AM <DIR> ..
1 File(s) 42 bytes
2 Dir(s) 12,065,521,664 bytes free
Writing Your First Python Program

• Click on Start >> Windows Accessories >> Notepad to open the Notepad editor.
• In Notepad type in the following program exactly as written:

# File: Hello.py

print ("Hello World!")

• Go to File and click on Save as.


• Browse for the for the folder you created to store your Python programs.
• For the field File name remove everything that is there and type in Hello.py.
• Click on Save. You have just created your first Python program.
• To verify you did everything correctly, go to the Command Prompt window and type
“dir” and you should see the Hello.py listed.

Running Your First Program

• To run the program, in the Command Prompt window (with your directory set to the one
with your Python files in it), type python Hello.py and hit Enter.
• You should see the line Hello World!
• Congratulations, you have run your first Python program.

You might also like