Page 28 - Raspberry Pi as a Foundation for Boosting Computer and Technology Literacy
P. 28

2  Raspberry Pi OS
                  Bookworm is the latest iteration of Raspberry Pi OS (remember that
                Raspberry Pi 5 is only compatible with this version). In previous ver-
                sions, it was possible to install Python libraries system-wide by using
                the pip package management tool, which has become impossible with
                Bookworm. Now, packages must be installed into a virtual environ-
                ment so that they do not interfere with the system version of Python.
                For example, if you have a project that you have named “gpt-project”,
                the Python virtual environment is created by typing:
                  python -m venv gpt-project

                  Then you have to change directory to the newly created environ-
                ment folder, which contains a full Python distribution, and activate it:

                  cd gpt-project
                  source bin/activate

                  The virtual environment is now ready to use. From within the virtu-
                al environment you can install any package you need using a pip com-
                mand  – for example, openai – by typing:

                  pip install openai
                  This will install the module, along with any independencies it re-
                quires, within the Python virtual environment. The advantage of this
                extra step is that it allows you to work on Python projects with specific
                dependencies in isolation from your system-wide Python installation.
                  If you reboot the Raspberry Pi, you will need to reactivate the Py-
                thon virtual environment to use it again.

                2.2  Other operating systems  2.2

                Some operating systems were mentioned in the previous subchapter,
                but we were far from reaching the end of the list. Raspberry Pi OS is
                widely accepted for its compatibility and ease of use with Raspberry Pi
                hardware. As seen above, different operating systems cater to different
                needs: they are either lightweight (say, for good performance on old-
                er models) or meant for systems used for media centres, IoT, gaming,
                home automation, network attached storage, or security testing. It has
                become obvious by now that Raspberry Pi OS has been designed with
                one main purpose in mind: educational use. The pre-installed software
                (Scratch, Thonny, Phyton IDE) are all suitable for beginners who wish
                to learn coding and digital creation in an interactive and user-friendly


                            28
   23   24   25   26   27   28   29   30   31   32   33