Skip to content

Instantly share code, notes, and snippets.

@quagly
Last active January 26, 2024 00:38
Show Gist options
  • Save quagly/c622ad8e55d775a1a3dec498b7df98ca to your computer and use it in GitHub Desktop.
Save quagly/c622ad8e55d775a1a3dec498b7df98ca to your computer and use it in GitHub Desktop.
pyenv-virtualenv-usage

examples of using pyenv-virtualenv to manage python enviornments

references

create new virtual environment and auto-vivify in project

Check python version

The current python version will be the version used in your new virtual enviornment

python -V

Python 3.12.0

list other versions installed

pyenv versions

change version

pyenv global 3.11.4

Create environment

use a meaningfull name. in this example I will use example

pyenv virtualenv example

set environment to automatically be used when in a directory

mkdir ~/example
echo "example" > ~/example/.python-version

verify

cd ~/example/
pyenv version

delete virtual environment

pyenv uninstall example

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