Managing Python Dependencies Transcripts
Chapter: Isolating Dependencies With Virtual Environments
Lecture: Destroying Virtual Environments

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Now what do you do once you're done with the virtual environment, or you want to recreate it from scratch? How do you get rid of them?
0:08 Because, if you're working with virtual environments over time, you are going to accumulate a couple of them,
0:14 if you're creating one per project, and so what do you do when you want to get rid of these virtual environments to reclaim the space they take up?
0:21 I am going to show you how to do that now. So we're going to delete an existing virtual environment here,
0:28 so right now, I am in this test project folder, and I am inside and active virtual environment; so in order to delete this virtual environment,
0:36 I would first of all deactivate the environment so that we're back in the global environment, and then all you need to do is delete this venv folder.
0:47 So, what I am going to do here is I am going to delete it using the rm command and you always want to be careful
0:53 when you are running this command just as a word of warning, because you can easily delete a bunch of stuff that maybe you don't want to delete.
1:01 So it might be easier for you to actually go into a file manager and just to delete the venv folder there
1:09 if you absolutely want to make sure nothing can go wrong. But I am going to go ahead here and I am just going to delete this folder,
1:15 and now you can see the project folder is empty or I actually deleted this venv folder, which means now the virtual environment is gone,
1:22 it doesn't take up any space anymore and if I wanted to, I could recreate a virtual environment under the same name
1:29 and then just repopulate again and configure it in the way I want. So this is a great way to reset a virtual environment if something went wrong,
1:36 you just wipe it out completely, delete it and then rebuild it from scratch.


Talk Python's Mastodon Michael Kennedy's Mastodon