Skip to content

Instantly share code, notes, and snippets.

@discdiver
Created October 18, 2024 19:58
Show Gist options
  • Save discdiver/5cd479e1f8cd68f0769f7d1c358b9b59 to your computer and use it in GitHub Desktop.
Save discdiver/5cd479e1f8cd68f0769f7d1c358b9b59 to your computer and use it in GitHub Desktop.
Create a Python virtual environment with venv

Instructions for creating and activating a virtual environment with venv

If you are comfortable with conda, uv, pipenv or another virtual environment tool, feel free to use one of those tools to create a virtual environment instead.

Ensure you are not in a virtual environment already. Generally, you will know you are in a virtual environment because your command line prompt will include the virtual environment name in parentheses.

Venv comes installed with Python. If you need to install Python 3.12, download it from python.org.

Create a virtual environment with venv named worklow_env with Python 3.12:

python3.12 -m venv workflow_env

Activate the virtual environment (macOS or Linux):

source workflow_env/bin/activate

Activate the virtual environment (Windows):

workflow_env\Scripts\activate

You should see (workfow_env) in your CLI prompt.

If you need help, see the venv docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment