|  | 
|  | 1 | +# Learn Python Programming 3rd Edition | 
|  | 2 | + | 
|  | 3 | +Welcome to Learn Python Programming, 3rd Edition. | 
|  | 4 | + | 
|  | 5 | +Here you can find the complete source code for this book. Every | 
|  | 6 | +line of code you will find in the book is in this repository, plus | 
|  | 7 | +all the code that we couldn't fit in the book. | 
|  | 8 | + | 
|  | 9 | +## Working on a chapter | 
|  | 10 | + | 
|  | 11 | +We suggest you create a dedicated virtual environment for each chapter | 
|  | 12 | +you wish to work on. Chapters that require third-party libraries will | 
|  | 13 | +have a folder inside, called `requirements`. | 
|  | 14 | + | 
|  | 15 | +First you will need to create a virtual environment. If you don't know | 
|  | 16 | +what a virtual environment is, please read Chapter 1. | 
|  | 17 | + | 
|  | 18 | +Let's now pretend you want to work on Chapter 12. First, change into the folder | 
|  | 19 | +for Chapter 12 (it's called `ch12`): | 
|  | 20 | + | 
|  | 21 | +    $ cd ch12 | 
|  | 22 | + | 
|  | 23 | +Then, create a virtual environment. In this example the virtual environment | 
|  | 24 | +will live inside the chapter's folder, but you can choose any other folder | 
|  | 25 | +that might suit you better. | 
|  | 26 | + | 
|  | 27 | +    $ python3.9 -m venv .venv | 
|  | 28 | + | 
|  | 29 | +We have given the virtual environment folder the name `.venv`. Feel free | 
|  | 30 | +to choose any other name that you might want. | 
|  | 31 | + | 
|  | 32 | +Next step is to activate the virtual environment: | 
|  | 33 | + | 
|  | 34 | +    $ source  .venv/bin/activate | 
|  | 35 | + | 
|  | 36 | +If you're on Windows, to activate your environment, you will need to run: | 
|  | 37 | + | 
|  | 38 | +    $ .venv\Scripts\activate | 
|  | 39 | + | 
|  | 40 | +Next, if the `requirements` folder is present, change into it, and run | 
|  | 41 | +the following command for each of the `.txt` files you will find in it. | 
|  | 42 | +Normally there is only a `requirements.txt` file. | 
|  | 43 | + | 
|  | 44 | +    $ cd requirements | 
|  | 45 | +    $ pip install -U -r requirements.txt | 
|  | 46 | +    $ cd ..  # this brings you back to the root of the chapter | 
|  | 47 | + | 
|  | 48 | +Once you have installed all requirements, you are ready to run the | 
|  | 49 | +chapter's code. If a chapter needs extra work to be set up, you will | 
|  | 50 | +find all the instructions you need in the chapter's text. | 
|  | 51 | + | 
|  | 52 | +**Note**: | 
|  | 53 | +Always remember to activate the virtual environment before you install | 
|  | 54 | +third-party libraries. | 
0 commit comments