Skip to content

Instantly share code, notes, and snippets.

@alzaabi98
Last active May 18, 2020 03:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alzaabi98/543354d9213a6ce94e399f37479449d2 to your computer and use it in GitHub Desktop.
Save alzaabi98/543354d9213a6ce94e399f37479449d2 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