Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to activate virtual environment from Windows 10 command prompt?

I'm trying to create and activate a virtual environment, using Windows 10 command prompt. I know that virtualenv is installed correctly, as the command

virtualenv venv

Works. I've navigated to my virtualenv download, Downloads\venv\Scripts, and am trying to activate my virtual environment venv. I've tried

venv activate

Which doesn't work since Windows doesn't recognize venv as a command. I've also tried

virtualenv venv activate

Which also doesn't work since virtualenv is saying that "venv activate" isn't a valid argument.

like image 457
Leonardo the Vinchi Avatar asked Oct 23 '17 18:10

Leonardo the Vinchi


2 Answers

Use the activate script in the Scripts directory of your virtual environment:

> venv\Scripts\activate

This will activate your virtual environment and your terminal will look like this depending on the directory you're in:

(venv) C:\Users\acer\Desktop>

I hope this helps!

like image 147
Bayard Avatar answered Oct 16 '22 22:10

Bayard


From the directory where you have your virtual environment (e.g. myenv)

you need to run the following command: .\myenv\Scripts\activate

like image 27
Alexkha Avatar answered Oct 16 '22 21:10

Alexkha