Python Tutorial: VENV (Windows) - How to Use Virtual Environments with the Built-In venv Module

Corey Schafer · 608K views · 2019 · 17:10

Open on YouTube

Python, Ruby & scripting languagesTesting, debugging & developer toolstutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering Windows questions about setting up, activating or moving a Python virtual environment.

Recommended by 3 people across 3 different months, 2020 to 2020.

What it is

A Corey Schafer tutorial that shows how to create, activate, use and delete Python virtual environments on Windows with the built-in venv module. It is a screen-recorded walkthrough of the commands and workflow, with a companion video for Mac and Linux.

What people said

Recommends daniel-eh · 2020-05 · Stack Overflow · on “Cannot import any modules to my python project”

I'm not sure if you're doing this, but I would create a virtual environment for your project and install your modules that way. I personally feel like I have less issues with this. Here's a good video about virtual environments: [this video] Then when you're using the integrated terminal for pip install, just make sure it's using the virtual environment.

Recommends Beast · 2020-08 · Stack Overflow · on “Source command error in Windows 10 on cmder”

1.use cmd rather that cmder 2.to create env use "python -m venv <name_of_your_env>" 3.after this check if it created the environment or no by using "dir" 4.to activate the environment use "<name_of_your_env>\Scripts\activate.bat" 5.to deactivate the environment use "deactivate" 6.to delete the environment completely use "rmdir <name_of_your_env> /s" You can also refer to this video if my explanation is not clear: [this video]

Recommends Eeshaan · 2020-10 · Stack Overflow · on “Move a python project from machine A to machine B including external libraries”

Normally you create a requirements.txt file and list out all the dependencies of your project in it, so that a single installation command can be used to install those dependencies on a different system (or re install on the same system). This is the answer given by @Vignesh Rajendran. However for this method to work, the new system must have an internet connection. But since you stated that's not the case, you can use the below method instead. Have a virtual environment. When you need to move the project to a new system, you can move the environment folder along with the source code. You can find a good tutorial for the same here [this video] .