Blog Archives

How to run Python Programs on The Raspberry Pi

https://i2.wp.com/3.bp.blogspot.com/-nK57iX60MRc/UDe8zPcBffI/AAAAAAAAAl0/mzXVaFZZnt8/s1600/python_banner.jpg

If you are new to the RPi, Python or just need a little bit of help. you may not understand how to run many of the Python Programs that you can find on this site and on the Minecraft Forums. Well, look no further. Below, I have come up with a guide to get you on your feet in the world of Python! You will be running programs in no time at all!

  1. First, you are going to need to create the program. Well, not create exactly, copy. But you still need to create a file for it to go. Open up ‘LeafPad‘ and paste the program code into the file.
  2. Save the program in your /mcpi/api/python/ dictionary. Name it something sensible. If it is a rainbow program, name it rainbow.py. The .py allow the RPi to know that it is a Python file.
  3. Now, open up MCPI and load up a world.
  4. Open up a new ‘LXTerminal‘ and navigate to your /mcpi/api/python dictionary, by using the cd command:
    cd /mcpi/api/python
  5. Next, type:
    python ProgramName.py 

    (Obviously you need to replace ProgramName with whatever you called the file).

  6. The program should now be running.

If this guide doesn’t work for you at first, try again. If on the third time you still don’t succeed, leave a comment!

Advertisements