Welcome to the “Environment Management” tutorial!
Overview
Isolate project dependencies using virtual environments and tools.
Built-in venv
- Create env:
python -m venv venv
- Activate:
- Windows:
venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Windows:
- Install packages:
pip install requests
- Freeze requirements:
pip freeze > requirements.txt
pipenv (Alternate)
pip install pipenv
pipenv install requests
pipenv shell
poetry (Alternate)
pip install poetry
poetry init
poetry add requests
poetry shell
Key Takeaways
- Use virtual environments to keep projects isolated.
- Tools like
pipenv
andpoetry
simplify dependency management.
Happy coding!
Comments
Post a Comment