What is the alternative for source command in cmd?

49,400

Solution 1

At CMD prompt,it worked by running

myvenv\scripts\activate.bat

Solution 2

For activating an environment:

activate myenv

for deactivating (all)

deactivate

Solution 3

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>

Share:
49,400
blank_mind
Author by

blank_mind

Updated on September 18, 2022

Comments

  • blank_mind
    blank_mind over 1 year

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

    source myvenv/bin/activate
    

    so as to activate and enter into my virtual environment.

    • Admin
      Admin almost 6 years
      Batch file can automate what you want, but you need to know what activate does, and translate it accordingly.
    • Admin
      Admin almost 6 years
      Well I do not have any idea how to do this :/
    • Admin
      Admin almost 6 years
      If you have solved the problem, please post your answer as an answer in the “Your Answer” box (below).
  • blank_mind
    blank_mind almost 6 years
    not working says 'activate' not a recognized command
  • MarianD
    MarianD almost 6 years
    Did you used conda for creating your environments? Try the command conda from your cmd window.
  • Anaksunaman
    Anaksunaman almost 6 years
    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).
  • Señor CMasMas
    Señor CMasMas almost 5 years
    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.