Practical Coding in Python

Learn to write and validate your own code

Darren Kessner, PhD

(revised September 1, 2025)

Previous: Appendix A: Virtual Environments and Libraries

Exercises: Installing and using libraries

In these exercises you will install and try out various Python libraries. For each example:

  1. Create a new folder for your project.

  2. Create a file in this folder called requirements.txt to specify the libraries you want to install, one library per line:

    emoji
  3. Create a new virtual environment called venv.

    python3 -m venv venv
  4. Activate the virtual environment.

    source venv/bin/activate
  5. Install the libraries listed in requirements.txt.

    pip install -r requirements.txt
  6. Copy and run the example code.


Next: