Python makes heavy use of external packages that we grab from pip or conda. It’s good practice to isolate our environments with virtual environments (venv
), so that we don’t clutter our global environment. This allows us to install only the dependencies we need for certain projects.
We can follow these steps:
python3 -m venv <ENVNAME>
: creates the environment in the current working directory.- Then, we can activate it:
<ENVNAME>\Scripts\Activate.ps1
: on Windows systems.<ENVNAME>/bin/activate
: on Linux and UNIX systems.
deactivate
: to exit the current virtual environment.