Setting up the OS 2 – Setting Up the Python Coding Environment

Setting up the OS 2 – Setting Up the Python Coding Environment

As we can see, Python 3 is already installed in Ubuntu, and when we type python3, we can enter Python and start coding. In Figure 2.3, we just printed a nice Hello Streamlit! message and then quit.

If you encounter an error while typing python3, it is possible that your system has Python available as python without the 3. In such cases, you should use python instead of python3.

Let’s check whether pip is installed in our Ubuntu box. Type in the following command:
pip –version (or pip3 –version)

If pip is not installed, we can install it by typing in the following command:
sudo apt install python3-pip

In the following figure, we can see how easy the pip installation is:

Figure 2.4: pip3 installation

Now, just to get familiar with pip, we will install a couple of tools that will be quite useful in the future: tree and terminator.

tree is a simple tool to visualize files and folders in the terminal as trees. We can install it by typing the following command:
sudo apt install tree

And once the installation is completed, just type tree and you will have a nice tree view of the working directory, as shown in the following figure:

Figure 2.5: The “tree” command

terminator is an alternative terminal that has some advanced features, such as horizontal and vertical splits, focus shifting, and zooming and preferences settings, but the most important one for sure is the possibility of splitting the screen into tiles as many times as we want. Let’s install it by typing the following command:
sudo apt install terminator

Then, once the installation is finished, just type terminator. As you can see in the following figure, by just right-clicking, you can create as many tiles with new terminals as you want, both vertically and horizontally:

Figure 2.6: Terminator and its tiles

Finally, what is important is having Python running. We prefer running it on Ubuntu just to keep things cheap and simple, but if you want to use your own OS it’s no problem at all. Just double-check whether you have the Python 3 version installed and if not, please download it from Python’s official website (https://www.python.org/) and then install it (please get the version specific to your OS):

Figure 2.7: Python website

At this point, we have done more or less 50% of the job, since we have a fresh OS with Python and the pip installation, together with a couple of nice tools such as terminator and tree. What we are still missing is a beautiful editor, so let’s get one!

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top