Korean

Using Python Virtual Environments (venv)

Dev Guides / python-venv.html

guidesEnv: Python 3.9+ (stdlib included)Verified: 2026-10-19

Create an isolated package space per project to avoid version clashes and global installs.

๐Ÿ’ฌ A virtual environment gives each project its own package room.

Installing globally causes version clashes between projects. With a venv you can install whatever version each project needs.

Create and activate

# in your project folder
python3 -m venv .venv

# activate
source .venv/bin/activate      # macOS / Linux
.venv\Scripts\activate        # Windows

# packages now install only into this environment
python -m pip install requests

Exit

deactivate

Common problems

  • pip install permission error: you are installing globally. Check the venv is active (which python).
  • Packages gone after reopening: the venv is not active. Confirm (.venv) appears in your prompt.

Sources

Verified date indicates freshness. Check applicability conditions for older material.