.gitignore for virtualenv

12 ignore rules for virtualenv, ready to copy into your repository.

Python virtual environment tool

The complete .gitignore for virtualenv

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-09-17 17:41:05 UTC
# Technologies: virtualenv

### virtualenv ###
.venv/
# Virtual environment directory
venv/
.python-version
# Python version marker
.Python
[Bb]in
[Ii]nclude
pyvenv.cfg
[Ll]ib
[Ll]ib64
pip-selfcheck.json
[Ll]ocal
[Ss]cripts

What these virtualenv rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

General

Pattern What it ignores
.venv/ Virtualenv https://realpython.com/python-virtual-environments-a-primer/#the-virtualenv-project
venv/ Virtual environment directory
.python-version General
pyvenv.cfg General
pip-selfcheck.json General

Custom python interpreter

Pattern What it ignores
.Python Python version marker
[Bb]in Custom python interpreter
[Ii]nclude Custom python interpreter
[Ll]ib Custom python interpreter
[Ll]ib64 Custom python interpreter
[Ll]ocal Custom python interpreter
[Ss]cripts Custom python interpreter

How to use this .gitignore for virtualenv

  1. Copy the virtualenv rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.

Other Tool .gitignore templates

See every Tool template