Managing Python Dependencies Transcripts
Chapter: Isolating Dependencies With Virtual Environments
Lecture: Leaving and Switching Between Virtual Environments
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
Another important aspect that I would like to cover is how to leave a active virtual environment,
0:08
and then also how to switch between different virtual environments. So again, I am going to jump to the terminal for this.
0:15
Alright, so I am back in my example project, inside an active virtual environment. Now, how do you get back to the global environment
0:23
if you are inside an active virtual env? And the answer for that is pretty easy, you just run the deactivate command.
0:29
So the deactivate command is available every time we're working in an active Python virtual environment,
0:36
the global environment does not support this deactivate command. Now you can see here that when I ran the deactivate command,
0:44
it actually removed this little marker here, from my shell prompt, so now I can tell that I am back in the global environment.
0:52
One more thing I wanted to mention is how do you actually switch between different virtual environments if you are working with multiple projects
0:58
so right now I am still in this virtual environment for my test project here, and what I am going to do here is I am going to leave that environment
1:08
and then I am going to go to a different project folder that also has a virtual environment, and here, I would just use the same activate command
1:17
to switch into that virtual environment and then start working from here. And it's a good idea to deactivate or leave an active virtual environment
1:26
before you go and activate or enter a new environment.