Author: Advanced Aircraft Design Lab (AADL) at the Royal Military College of Canada
Revision: 1.0
Date 30-01-2012
This guide is intended to help you setup a python programing environment on a Windows 7 machine suitable for engineering programming tasks.
Here are some links to useful python learning resources:
A chart which compares common Matlab functions with their numpy equivalents.
This is a good, free, online textbook which allows you to work through a series of tutorials.
The definitive style guide. May not be completely understandable for new users
Co-authored by python’s Benevolent Dictator for Life, Guido van Rossum.
These books are available from the ACD Lab.
Introductory text.
Poor reference book, should be read cover to cover
Advanced topics.
Good reference book.
Use the 32 bit version for compatibility.
Install in the default directory <C:\Python27\> You will have to add python to the system path:
Right click on ‘My Computer’
Click on properties
Click on ‘Advanced system settings” on the bottom left of the window
Click on ‘Environment variables’
In the second window, scroll down and select ‘Path’
Click Edit
Keep all the text. Add a semicolon (‘;’) then add the path to the python installation directory (Typically C:Python27)
Click ok
Click ok
Click ok
Version: 32 bit for python 2.7
Note Used to make python work like Matlab.
Version: 32 bit for python 2.7
Note: Used to plot things.
Version: 32 bit for python 2.7
Note: Used to make GUI’s. Needed to install Dr. Python.
Version: Any (Most recent preferred)
Note: Preferred python development environment and editor.
Installation Instructions:
Extract into
$HOME\Downloads\
where $HOME is:C:\Users\\username\
Open windows power shell or command prompt if available
Navigate to
$HOME\Downloads\
:>> python setup.py build >> python setup.py installCreate a desktop shortcut to:
C:\Python27\Lib\site-packages\drpython\drpython.py
The icon for Dr. python is located in:
C:\Python27\Lib\site-packages\drpython\bitmaps
Version: Any (Most recent preferred)
Unlike Dr. Python, you cannot run python scripts from within gedit
Note the warning under the windows section in the following link from Learn Python the Hard Way
You do not need these packages but they may be necessary for some specific tasks
Version: 32 bit for python 2.7
Most of the scipy tools are not suitable for paralell programming and their use in AADL code is strongly discouraged
Open a command prompt or windows power shell.:
>>python
in python type:
>> import numpy as np
>> import matplotlib.pyplot as plt
>> a=np.array([1.0,2.0,3.0,4.0])
>> b=a**2
>> plt.plot(a,b)
>> plt.show()
A plot window with a parabolic curve should appear. If any errors occur along the you made a mistake.
Close the plot window.:
>>exit()
Close the command prompt.
Open Dr. Python
Copy the same code as before and then click the “play” button. You will have to save your script to run it.
A plot window with a parabolic curve should appear. If any errors occur along the you made a mistake.