IPython is a command shell that allows users to perform interactive computing in multiple programming languages, especially Python. It has an enhanced interactive environment with many functionalities, including rich media, tab completion, shell syntax and more. It’s different from the previously used Python shell and uses the Jupyter kernel to allow users to work with Python code in Jupyter notebooks.
This article will help users install IPython on Raspberry Pi.
How to Install IPython on Raspberry Pi
Since IPython is a tool used mostly for the Python programming language, Raspberry Pi users can easily install it from Python Package Management (pip). However, before that, ensure pip is installed on your Raspberry Pi system using the following command:
If pip isn’t installed on Raspberry Pi, use the guidelines here.
After ensuring pip is installed, you can run the following command to install IPython on Raspberry Pi:
To confirm IPython is successfully installed on the Raspberry Pi system, follow the below-given command:
Run IPython on Raspberry Pi
You can run IPython on Raspberry Pi terminal using the following command:
This opens the Enhanced Interactive Python interpreter on the terminal.
Use IPython on Raspberry Pi
Let’s first create a Python file in a separate terminal using the nano editor through the following command:
Inside the file, add the following Python code for displaying a message on the terminal.
Save the file using “CTRL+X”.
Now, at the IPython interpreter, you have to run the Python file using the “run” command as shown below:
The file’s output will display right after you execute the run command.
To check for recently performed activities on the IPython interpreter, you can use the following code:
You can also assign the system’s output to a Python variable like the following:
Now run the following code to display the time on your system:
Similarly, you can also display a message with system command calls by observing the following example:
Now, run the following code with the callout variable you defined in the above code inside the curly brackets:
You can also prefix Python variable with $ command to get the similar output of the above example:
To learn about IPython in details, you can open its manual in the terminal using the following command:
Conclusion
IPython is an enhanced interactive command shell for Python with easy configuration, command completion, Jupyter notebook, QT console, and much more. You can easily install it on Raspberry from “pip”. After the installation, you can run IPython with the command “ipython” and start performing Python programming on the terminal through the guidelines mentioned above. For further guidance, you can get help from the IPython manual by opening it on the terminal using the “man” command.