activate script
The script inside a virtual environment that puts it first on PATH for the current shell session.
In more detail
On macOS and Linux run source .venv/bin/activate; on Windows run .venv\Scripts\activate. All it does is change PATH, set VIRTUAL_ENV and add the environment name to your prompt. deactivate undoes it; you can also skip activation and run .venv/bin/python directly.
Related terms
- virtual environment — A self-contained folder with its own Python and its own installed packages, so each project's packages stay separate.
- PATH — An environment variable holding a list of folders the shell searches, in order, to find the program for a command you type.
- VIRTUAL_ENV — An environment variable set by the activate script to the folder of the active virtual environment.
Taught in
- Installing Python On Linux — Hands-on Python: Complete Video Course & Book
- Virtual Environments — Hands-on Python: Complete Video Course & Book
- pip, requirements, and installing packages — Hands-on Python: Complete Video Course & Book