venv
Konstantinos Blatsoukas
Posted on October 15, 2024
python vevnv
Is used for separating packages versions per project.
For example, one project may use a package named foo-1-0, but another project uses foo-2-0.
We can not separate them using the global environment.
The solution is, to create two different virtual environemnts.
list all global packages
pip list # list all packages
create a new virtual environment
# a new virtual environment with name project_env will be craeted
python -m venv project_env
activate venv
activate
# activate on ubuntu
source myenv/bin/activate
deactivate venv
deactivate
generate packages version for requirements.txt
pip freeze
pip install -r requirements.txt
generate required python packages
python -m venv vevn
source vevn/bin/activate
pip install pip-tools
pip-compile requirements.in
pip install -r requirements.txt
💖 💪 🙅 🚩
Konstantinos Blatsoukas
Posted on October 15, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.