An important yet often overlooked aspect of Python programming is how to correctly set up and maintain a Python project and its runtime environment. It is often overlooked because it presents as an optional step for the Python ecosystem. And while this might be fine for learning Python language fundamentals, it can quickly become a problem for more complex projects where we need to maintain separate code bases and dependencies to ensure our projects do not interfere with one another, or worse as we will discuss, break operating system tools and utilities.
So, before we jump into IoTÂ code and examples in later chapters, it is so very important for us to cover the steps required to set up a Python project and its run time environment.
In this chapter, we will cover the following topics:
- Understanding your Python installation
- Setting up a Python virtual environment
- Installing Python GPIO packages with pip
- Alternative methods of executing a Python script
- Raspberry Pi GPIO interface configuration