Login

Please fill in your details to login.





python programming

Learn to program in Python.
Now, hopefully, you've learnt what algorithms are, how to represent them, and a little about the Python programming environment, it's time to learn a little more about Python. There are plenty of free courses, resources and books out there, so there are no excuses. There is also plenty of opportunity to program in the courses on The Computing Café but you will still need to do a lot of work on your own.

Click for Snakelets

Install Python 3


Standard Python

1
Install Python 3

Grab Python from the Python website (use the latest version for increased compatibility)

When you are installing Python, make sure that you opt to add Python to the 'path'. After Python has installed, make sure it works by starting up IDLE (the built in development environment) from the start menu - you might not know what to do yet, all will be revealed later! To install the rest of the useful packages, you need to use a 'command window' (probably as an Administrator) which you can start by typing 'cmd' in the 'Search programs and files' box on the Windows start menu. Type 'cd c:\' and press the ENTER key on your keyboard before you perform the next steps.

2
Install the Numpy library

First, install Numpy by typing
pip install numpy
at the command prompt and pressing ENTER. Python should finish with
Successfully installed numpy-x.x.x
. Test your Numpy installation in IDLE ...

>>> import numpy
>>> numpy.version.version


3
Install the SciPy libary

Next, install SciPy by typing
pip install scipy
at the command prompt and pressing ENTER. Python should finish with
Successfully installed scipy-x.x.x
. Test your SciPy installation in IDLE ...

>>> import scipy
>>> scipy.version.version


4
Install the PyQT binding

It seems that you have to download the correct PyQT4 bindings and can't install them directly using 'pip'.

Download the PyQT4 binding for your version of Python, move the 'whl' file onto the C: drive and install it by typing
pip install pyqt_filename
at the command prompt and pressing ENTER. Python should finish with
Successfully installed PyQT4-x.x.x
. Unfortunately, this version of PyQT does not seem to install start menu shortcuts but you can find shortcuts to the two application you need in C:\Program Files\Python3X\Lib\site-packages\PyQt4 - make shortcuts to 'assistant.exe' and 'designer.exe' and pop them in the Python start menu folder. Test your PyQt4 installation in IDLE ...

>>> from PyQt4.QtCore import QT_VERSION_STR
>>> QT_VERSION_STR


5
Install Matplotlib

Install Matplotlib by typing
pip install matplotlib
at the command prompt and pressing the ENTER key. Python should finish with
Successfully installed matplotlib-x.x.x
amongst other dependencies. Test your Matplotlib installation in IDLE ...

>>> import matplotlib
>>> matplotlib.__version__ # There are four underscores!


6
Install PyGame

Install PyGame by typing
pip install pygame
at the command prompt and pressing the ENTER key. Python should finish with
Successfully installed pygame-x.x.x
. Test your PyGame installation in IDLE ...

>>> import pygame
>>> pygame.version.ver


7
Install Thonny

Finally, even though Python comes with it's own 'development environment' called 'IDLE', it's well worth installing Thonny. From the command prompt, type
pip install thonnyapp
and press the ENTER key. Python will download and install Thonny and a separate shortcut to the editor, hopefully responding with
Successfully installed thonnyapp-x.x.x
. If you don't get a shortcut to start Thonny on the Windows start menu, you can find the executable in the ...

[Python install directory] > Scripts > Thonny.exe


You should be able to successfully rerun the tests you performed earlier (or checkout all the installed packages from 'Tools > Manage Packages').

image
Ask your teacher then!

WinPython

Alternatively (and preferentially), you could install WinPython, a completely PORTABLE Python installation which comes in a full version with literally hundreds of libraries already installed or a 'zero' version into which you can install your own. I'm going to go for the zero version and install all the required libraries myself so I know what's there.

1
Download the light version of WinPython

Visit the WinPython homepage and click the 'Download' button next to the version of WinPython you wish to use (choose the 32 bit version for increased compatibility). This will take you to the Sourceforge page for WinPython - make sure you download the 32 bit 'Zero' version which will download as an 'exe' installer. Save this to your desktop or userspace.

2
Run the installer

Double click the installer, choose 'Run' and click through the dialogues accepting the default options. You should be left with a folder in the same location as the installer with the name WinPython-32bit-?.?.?.?Zero where the '?' will be different depending on which version you have downloaded. I have renamed the folder to 'WinPython' but you can leave it like this if you want. You can now safely delete the installer.

3
Customise the installation

WinPython Zero ships with shortcuts for all the tools but we can safely delete the ones we don't want. We've got enough programming environments and Spyder uses PyQT5 which doesn't work well with some of the GUI development tools we use. Open up the WinPython folder and delete ...

Spyder reset
Spyder

You should be left with ...

IDLEX (Python GUI)
IPython Qt Console
Jupyter Lab
Jupyter Notebook
Qt Designer
WinPython Command Prompt
WinPython Control Panel
WinPython Interpreter
WinPython Powershell Prompt

4
Install Numpy

Open up the 'WinPython Command Prompt' and type
pip install numpy
and pressing the ENTER key. Wait for the installation to complete and then test your numpy installation in IDLEX by typing ...

>>> import numpy
>>> numpy.version.version


5
Install SciPy

Back in the 'WinPython Command Prompt', type
pip install scipy
and press the ENTER key. Wait for the installation to complete the then test the installation by typing the following in IDLEX ...

>>> import scipy
>>> scipy.version.version


6
Install PyQT4

Download the PyQT4 binding for your version of Python, move the 'whl' file onto the 'scripts' directory in the WinPython folder and install it by typing
pip install pyqt_filename
at the 'WinPython Command Prompt' and pressing the ENTER key. Wait for the installation to complete and then test your PyQT4 installation in IDLEX ...

>>> from PyQt4.QtCore import QT_VERSION_STR
>>> QT_VERSION_STR


7
Install Matplotlib

Type
pip install matplotlib
in the 'WinPython Command Prompt' window to install Matplotlib and its dependencies. Wait for the installation to complete and then test your Matplotlib installation in IDLEX ...

>>> import matplotlib
>>> matplotlib.__version__ # There are four underscores!


8
Install Pygame

Type
pip install pygame
in the 'WinPython Command Prompt' window to install Pygame. Wait for the installation to complete and then test your Pygame installation in IDLEX ...

>>> import pygame
>>> pygame.version.ver


9
Install Jupyter Notebook

Type
pip install jupyter
in the 'WinPython Command Prompt' window to install Jupyter Notebook - a beautiful interactive Python programming environment. Test your Jupyter Notebook installation by double clicking the 'Jupyter Notebook' icon in the root distribution folder. You should see a command windows open up and then a browser window with the actual notebook.

image
Jupyter notebook

10
Install Jupyter Lab

Type
pip install jupyterlab
in the 'WinPython Command Prompt' window to install Jupyter Lab software - a more powerful (but probably less useful to us) scientific Python programming environment. Test your Jupyter Lab installation by double clicking the 'Jupyter Lab' icon in the root distribution folder. You should see a command windows open up and then a browser window with the actual lab.

image
Jupyter Lab

image

There are plenty of other useful libraries that you can install into either a standard Python Installation or into a portable WinPython installation including ...

easygui - Simple GUI development (
pip install easygui
)
guizero - Slightly better GUI development (
pip install guizero
)
pillow - Image / graphics manipulation library (
pip install pillow
)

... and I'll add to the list as I find more!

Free books


Grab yourself some free 'books' from the World Wide Web...


Online Courses


Enrol on an online course to help you learn

Interactive Python (this is a *great* interactive textbook)
Grok Learning (this has a paid subscription but is *well* worth it!)

YouTube


The list is endless, but here are a few of the best ...

PythonByteSize - over one hundred free video tutorials on Python 3 from basics to some really advanced stuff suitable for A Level and beyond. Lots of the videos are concerned with programming Graphical User Interfaces using the Python Tkinter library.

PythonByteSize Playlist
This is an embedded playlist so if you click on the ...

image

... icon, you can choose a different video to watch if you like.

Visit the PythonByteSize website and subscribe to the channel on YouTube.

Socratica - 30 or so videos which give you a quick (and humorous) introduction to Python

Socratica Playlist
This is an embedded playlist so if you click on the ...

image

... icon, you can choose a different video to watch if you like.

CS Dojo - Introduction to Python programming for absolute beginners. CK uses Jupyter Notebook to teach this online course; look back to the installation instructions for WinPython which might be a little easier than installing through the Anaconda Package Manager ...

CS Dojo Playlist
This is an embedded playlist so if you click on the ...

image

... icon, you can choose a different video to watch if you like.

Learn to Code GCSE - Brilliant series outlining all the basic and more advanced techniques used to learn to program in Python for GCSE level and beyond. There are currently four playlists to choose from...

Learn to Code Basic Playlist
Beginners

This is an embedded playlist so if you click on the ...

image

... icon, you can choose a different video to watch if you like.

Learn to Code Advanced Playlist
GCSE Level

This is an embedded playlist so if you click on the ...

image

... icon, you can choose a different video to watch if you like.

Learn to Code Pygame Playlist
Pygame

This is an embedded playlist so if you click on the ...

image

... icon, you can choose a different video to watch if you like.

Learn to Code Text Adventure Playlist
Text adventure

This is an embedded playlist so if you click on the ...

image

... icon, you can choose a different video to watch if you like.

page icon
This page is mainly about open py files in idle with double click
page icon
This page is mainly about python projects
page icon
This page is mainly about python snakelets
page icon
This page is mainly about tkinter
Last modified: February 14th, 2024
The Computing Café works best in landscape mode.
Rotate your device.
Dismiss Warning