Skip to content

Commit

Permalink
Update new-virtualenv.md
Browse files Browse the repository at this point in the history
  • Loading branch information
williln authored Feb 26, 2024
1 parent b1cb257 commit 4b7ffba
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions python/new-virtualenv.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

With:

- virtualenvwrapper
- pyenv

See [Managing Multiple Python Versions With pyenv](https://realpython.com/intro-to-pyenv/#using-pyenv-to-install-python) for info on installing multiple versions of Python. See this [StackOverflow](https://stackoverflow.com/questions/73898903/how-do-i-get-pyenv-to-display-the-executable-path-for-an-installed-version) for info on how to get the path to your python.
See [Managing Multiple Python Versions With pyenv](https://realpython.com/intro-to-pyenv/#using-pyenv-to-install-python) for info on installing multiple versions of Python.

When you need a new virtual environment with a specific Python version, you need to specify the path to that version of Python. With pyenv, it took me a second to figure that out.

Expand All @@ -15,9 +14,13 @@ Run `pyenv which python` to get the current version of Python, and by extension,
/Users/lacey/.pyenv/versions/3.7.6/bin/python


Replace `3.7.6` with whichever version of Python you have installed when you run the command to make the new virtualenv.

$ mkvirtualenv -p /Users/lacey/.pyenv/versions/3.10.4/bin/python venv-name
$ (venv-name)

Move on with your life!

# Create a new virtual env
pyenv virtualenv <python_version> <environment_name>

# Activate the venv
pyenv activate <environment_name>

# Deactivate the vent
pyenv deactivate

0 comments on commit 4b7ffba

Please sign in to comment.