Modern Python Projects Transcripts
Chapter: Python versions and packages
Lecture: Using a virtual environment

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So, we created an activated, a virtual environment. We know that it's active because the prompt in our terminal has changed.
0:09 But how do you work with this virtual environment? Well, now we do everything that we would do normally when building a Python project
0:15 If you install a package with pip, it will be installed inside this virtual environment. You can actually see that. Currently,
0:22 we don't have any packages installed by running pip freeze command. Let's install Django here. When we do pip freeze again,
0:36 we can see that we have Django installed. If you want to stop using a virtual environment, you just need to run the activate command in your terminal.
0:44 When you call the activate, it will revert all the changes that the activate command did.
0:48 So, it will go back to using the global Python version and global pip packages If we now run, pip freeze,
0:56 you can see that we no longer have Django 3 that we just install. We are outside of a virtual environment.
1:02 So now we're back to the global packages and here we have Django 2 that we installed in the previous lessons and some other packages like requests.
1:12 Finally, If you ever want to get rid of a virtual environment, you can just delete the folder, where the virtual environment was created.
1:20 In our case, if we want to remove the my_first_virtualenv and we simply delete that folder.

Talk Python's Mastodon Michael Kennedy's Mastodon