Python
Virtual environments
Section titled Virtual environmentsVirtual environments are essentially local environments for Python so that you don’t install packages globally. It also lets you freeze version numbers so that you’re getting the same environment every time.
- To create one:
python3 -m venv venv
- This will make a
venv
folder, which you should add to your.gitignore
with avenv/
line.
- This will make a
- To use one:
source venv/bin/activate
- After doing this, all of your installations will go into the local environment, e.g. packages will be installed in something like
venv/lib/python3.11/site-packages
.
- After doing this, all of your installations will go into the local environment, e.g. packages will be installed in something like