venv
venv
Every python project should have its own virtual environment such that requirements can be managed on a project basis rather than polluting the global pip.
Initialize a virtual environment
python -m venv myvenvNext, activate it:
source myvenv/bin/activateNow, one can, e.g., install requirements from a requirements.txt file, which then only will be available within the virtual environment myvenv.
pip install -r requirements.txtThat way, the global pip stays nice and clean.
Finally, deactivate the virtual environment by deactivate to return to the usual shell.
Last updated