how to Create and run virtual env using command prompt

how to Create and run virtual env using command prompt

Bloghow topythonweb development
  • Create a project/folder in workspace in VS Code
  • Open the Terminal and run the below command to create virtual env
    python -m venv env
  • A new folder named env will
  • Now we have to activate the virtual env using below command
  • Now virtual env is activated we can see it in our command prompt as below
Image 18

now we can run our application for example if its a Flask
flask run


  • If we want to install requirement.txt we can run below command
    pip install -r .\requirements.txt
  • if we want to create requirement.txt we can use below command
    pip freeze > requirements.txt
  • If we want to create a .ignore file we can use below command
    touch .gitignore
    if this command is not working in command prompt you can use git bash window it should work there
    (why do we create .gitignore file – if we don’t want to include any file or folder in check-in to github in that case we can create this file and we can include the file or folder name into that)
    Example – inside the .gitignore file we can mention env/ folder because we don’t want it to be included in github repository
  • we can run our flask application in command prompt as well instead of browser using below command
    curl -i -X GET http://localhost:5000/



Leave a Reply

Your email address will not be published. Required fields are marked *