Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmadtech199/41747ab8bfd74d08ad4e32dcb340c78f to your computer and use it in GitHub Desktop.
Save ahmadtech199/41747ab8bfd74d08ad4e32dcb340c78f to your computer and use it in GitHub Desktop.
This Gist to help developers remember commands for creating and managing python virtual environments using venv

1. Create new environment

python -m venv projcetA_env

2. Activate environment

windows : Go inside your folder project that has projectA_venv

projectA_venv\Scripts\activate.bat

Mac

source projectA_venv/bin/activate

2. Deactivate environment

deactivate

4. To see all environments

where python

5. To delete environment

rmdir projectA_env /S

6. Package management

* install package

pip install flask

* uninstall packages

pip unlist requests

* list packages

pip list

* list packages with versions for requirements export

pip freeze

* Save all current packages to requirments.text file

python -m pip freeze > requirements.text

* install packages from requirements file

pip install –r requirments.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment