pip and Virtual Environments
Install third-party packages with pip and isolate each project's dependencies with venv.
Beginner
python -m venv .venv # create an environment
.venv\Scripts\activate # Windows (source .venv/bin/activate on macOS/Linux)
pip install pyserial numpy
pip freeze > requirements.txt
Each project gets its own versions of libraries, so upgrading one project never breaks another. Share requirements.txt so others can run pip install -r requirements.txt.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.