-
Book Overview & Buying
-
Table Of Contents
Getting Started with Python and Raspberry Pi (Redirected from Learning Python By Developing Raspberry Pi Applications)
By :
The first thing we need to do is head to the Raspberry Pi downloads page at https://www.raspberrypi.org/downloads/ and download the latest version of Raspbian. This is a version of the Debian Linux distribution, specifically designed for the Raspberry Pi.

.img.The next step is to write the just downloaded operating system image to the SD card so that it can be used with the Pi. The way this is done varies depending on the operating system you use on your main PC.
On Windows, we will use a tool called Win32 Disk Imager to write the OS image to the SD card. This tool can be downloaded from the SourceForge page at sourceforge.net/projects/win32diskimager.

The important thing to check is that a drive letter appears in the Device drop down list. If this does not happen then Win32 Disk Imager has failed to recognize your SD card. In such a case, try it in a different SD card reader. If it still does not work then it could indicate that the card has failed.
.img file you had previously extracted from the downloaded Zip archive and click the Write button as shown in the following screenshot, after first making sure that the correct device is selected in the Device drop down list:


You now have Raspbian loaded on the SD card and can now move on to the Boot Pi for the first time. This will be covered in the following sections.
On Linux and Mac, the dd command line utility can be used to write the operating system image to the SD card.
udevadm monitor --udev
/dev/sdb1 and /dev/sdb2; from this we can deduce that the path to the SD card is /dev/sdb).
udevadm:umount PATH
Here PATH is the path to the partition. This should give an output similar to the following image if the partition was not mounted; otherwise the command will exit without printing any output:

sudo dd if=[path to .img] of=[path to SD]
Here [path to .img] is the path to the .img file extracted from the Zip archive downloaded earlier and [path to SD] is the path to the SD card we just discovered.
This process will take some time (up to 20 minutes) and is complete when the command exits and you see the next shell prompt as shown in the following screenshot. If the writing fails then an error message will be printed to the terminal.

Now that you have an SD card with Raspbian installed on it, you are ready to boot the Pi for the first time and perform the first time configuration steps required to get the Pi up and running.
Note that to fully setup the Pi, you will need to have a way to connect it to the internet in order to install and update the software packages. This can either be wired (using an Ethernet cable) or wireless (using a USB WiFi adapter).
Note that the USB power source should be able to supply at least 1.5A to ensure reliable operation of the Pi. Usually, the USB chargers supplied with the tablets are a good choice of power supply.




Note that when entering a password you will not see any characters appear on the screen.



wpa_gui by choosing the WiFi Configuration utility in the Preferences submenu from the main menu in Raspbian.



sudo apt-get update sudo apt-get upgrade
Each of these commands will take a few minutes to execute. The first updates the list of the available packages and the second updates each of the installed packages to the latest version.
Now that we have Raspbian setup on the Pi, we can move on to having a look at some of the tools we can use to write and execute Python scripts on the Pi.
Change the font size
Change margin width
Change background colour