Skip to content

Instantly share code, notes, and snippets.

@callezenwaka
Last active May 9, 2025 11:32
Show Gist options
  • Save callezenwaka/6f5467a6f474df0378da5616d5310454 to your computer and use it in GitHub Desktop.
Save callezenwaka/6f5467a6f474df0378da5616d5310454 to your computer and use it in GitHub Desktop.
Steps to Use `pyenv` to Create and Activate a Virtual Environment.

Summary of Commands

By following these steps, you can manage multiple Python versions and virtual environments efficiently using pyenv.

Install Python Version:

pyenv install <version>

Install a Python Version:

pyenv install 3.10.4

List available versions using:

pyenv install --list

Create Virtual Environment:

pyenv virtualenv <python-version> <env-name>

Create a Virtual Environment:

pyenv virtualenv 3.10.4 myenv

Activate Virtual Environment:

pyenv activate <env-name>

Activate the Virtual Environment:

pyenv activate myenv

or if pyenv activate is not available

pyenv shell <env-name>

Deactivate Virtual Environment:

pyenv deactivate

or if using pyenv shell

pyenv shell --unset

list of installed pyenv virtual environments

pyenv virtualenvs

Comments are disabled for this gist.