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

source myvenv/bin/activate

so as to activate and enter into my virtual environment.

  • Batch file can automate what you want, but you need to know what activate does, and translate it accordingly. – Darius May 23 '18 at 11:30
  • Well I do not have any idea how to do this :/ – blank_mind May 23 '18 at 11:32
  • If you have solved the problem, please post your answer as an answer in the “Your Answer” box (below). – Scott May 23 '18 at 19:01

At CMD prompt,it worked by running

  • Given this self-answer, the asker appears to be using vanilla Python and virtual environments created with python -m venv some-environment (rather than, say, using conda). – Anaksunaman May 24 '18 at 20:15
  • Specific to your question "What is the alternative for source command in cmd?" The equivalent command to "source" is "call".. but it is only used from another batch file. – Señor CMasMas May 14 '19 at 16:01

For activating an environment:

activate myenv

for deactivating (all)

  • not working says 'activate' not a recognized command – blank_mind May 23 '18 at 11:35
  • Did you used conda for creating your environments? Try the command conda from your cmd window. – MarianD May 23 '18 at 11:50

If you want to activate your virtual environment after running:

virtualenv env  

Just run:


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

Example Image


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>


In windows you don't need any command to activate an environment.

source myvenv/bin/activate

Image for demonstration and example:

enter image description here

just use:


Image for demonstration and example:

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.