What is the alternative for source command in cmd?

I want to run the Windows (Command Prompt) equivalent of

source myvenv/bin/activate

so as to activate and enter into my virtual environment.

3

5 Answers

For activating an environment:

activate myenv

for deactivating (all)

deactivate
2

At CMD prompt,it worked by running

myvenv\scripts\activate.bat
2

Go to the the directory where you have the ".bat" file by executing this command:

C:\Users\MyName\Desktop\ProjectsWork\FlaskApplication> cd env\Scripts

Then just call the ".bat" file

\Desktop\ProjectsWork\FlaskApplication\env\Scripts> activate.bat

(env) C:\Users\MyName\Desktop\ProjectsWork\FlaskApplication\env\Scripts>

If you want to activate your virtual environment after running:

virtualenv env 

Just run:

env\Scripts\activate

This command will provide you the correct path and the command "source" is not necessary.

Example Image

In windows you don't need any command to directly activate an environment (like a virtual machine) but simply add "activate" or "deactivate" to the end of the path to the environment.

source myvenv/bin/activate

Image for demonstration and example:

enter image description here

just use:

myvenv/bin/activate

Image for demonstration and example:

enter image description here

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like