1.9 KiB
status: #doc #unfinished Tags: #python #env #programming links:python Date: 2023-04-26
virtual environment python
venv
making new env
- for making new virtual env in current folder
python -m venv env
- env is name and address of virtual environment ex: inside folder named foo environment of bar
python -m venv foo/bar
activating env
- activating env in bash/zsh
source env/bin/activate
- activating in fish
source env/bin/activate.fish
- activating in windows
PS C:\> env\Scripts\Activate.ps1
deactivating env
- deactivating in all systems
(.venv)$ deactivate
Virtualenv
virtualenv
is a tool to create isolated Python environments , The venv
module does not offer all features of this library, venv is slower,not as extendable,- is not upgrade-able via pip,- does not have as rich programmatic API (describe virtual environments without creating them).
Installation
via pipx
pipx install virtualenv
virtualenv --help
other ways are not as good but if needed are in documentation
via zipapp
You can use Virtualenv without installing it too. pypa publish a Python zipapp, you can just download this from this link and invoke this package with a python interpreter:
python virtualenv.pyz --help
Poetry
References
https://dev.to/bowmanjd/python-tools-for-managing-virtual-environments-3bko#poetry https://dev.to/bowmanjd/getting-started-with-python-poetry-3ica