Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hours

(singke) #1
pi@raspberrypi ~ $

If you get the message command not found, then for some reason, the nano text editor is not
installed. Go to the “Installing Python and Tools” section in this hour to remedy this situation.


Hopefully, you have found nothing missing from your Python environment and all the tools you need
are loaded onto your Raspberry Pi. If nothing is missing, you can skip the next section and go straight
to “Checking the Keyboard.”


Installing Python and Tools


If you found anything missing from your Python environment, it’s not a big problem. In this section,
you will get everything you need installed very quickly by following these steps:



  1. If your Raspberry Pi has a wired connection to the Internet ensure that it is connected to the
    Internet and boot up your Pi.

  2. Start the LXDE GUI if it is not started automatically. If your Internet connection is wireless,
    ensure that it is working.

  3. Open the LXTerminal. At the command prompt, type sudo apt-get install
    python3 idle3 nano and press Enter.


By the Way: But I Don’t Need All Those Programs!
Don’t worry if the installation command in step 3 includes items that you already have
installed. It will simply get an already installed tool updated, if needed.

You should see several messages concerning the software installs/updates and then the question Do
you want to continue [Y/n]? Type Y and then press Enter. When the installs are
complete, you see a prompt. You should now go back through the “Checking Your Python
Development Environment” section to make sure all is well with your Python environment.


Checking the Keyboard


If you live and work in the United Kingdom, then most likely you can skip this section. For those of
you who live elsewhere, it is highly likely that your keyboard setup is not quite correct.


You probably have been using your keyboard with no problems so far. However, try a little test:
Press the @ key on the keyboard. Do you see a double quote (") instead of the @ symbol? If you do,
you need to work through this section to get your keyboard set up correctly.


If you have a typical U.S. keyboard, follow these steps to get your keyboard working properly for
programming in Python:



  1. If it is not already on, boot up your Raspberry Pi and open the LXDE GUI.

  2. Double-click the LXTerminal icon to open the LXTerminal window.

  3. Type sudo raspi-config and press Enter.

  4. In the Raspbi-config window, press the down-arrow key until you get to
    configure_keyboard and then press Enter. It may take several seconds for the next
    window to open, so be patient!

Free download pdf