Getting Started with the Interpreterįrom a terminal, enter the following commend to start the Python interpreter: language:bash If you are curious about where the phrase "Hello, World!" comes from, this Wikipedia article gives a brief yet fascinating history. This will show you two of the main ways to interact with Python.
We'll do this first from the interpreter and then we'll create a file and run it as a program. To start, we'll tell Python to print the phrase, "Hello, World!" to the terminal. This will allow us to test out commands one line at a time! In fact, we can even run the interpreter in what's known as interactive mode. translate our program into machine code) in order to run our program. This means that we don't need to run a separate compile step (i.e. One of the coolest features of Python is that it is an interpreted language (OK, in reality, Python scripts are first compiled to some bytecode, and that bytecode is interpreted). Scroll down to the bottom, and add the following command to the file: language:bash It can help to customize the user environment, and you will likely see a number of other commands already in there. The file acts as a shell script that is run each time that specific user opens a terminal (or logs in over SSH, Serial, etc.). bashrc is a file that resides in the user's home directory (the user pi in this case). We want to this so that Python 3 is used every time we log in.
If you see that your OS is using Python 2 by default, you'll need to change it to use the Python 3 installation. For example, you might see Python 2.7.13. You should see which version is being used by default. In a terminal window, enter the following command: language:bash We just have to make 1 minor change so that the Pi uses Python 3 whenever we type python into a terminal. However, versions 2 and 3 come installed by default. Use Python 3īy default, Raspbian (Stretch version April 2018 and earlier) uses Python 2.
#RASPBIAN PYTHON 2.7.9 DEVELOPMENT HEADERS SERIAL#
If you are using a Serial or SSH terminal, log back in using the username pi and the password you created earlier.
If asked to reboot, select Yes and press enter.