Issue
So first I installed pyenv with brew install pyenv
. After trying to install virtualenvs unsuccessfully I installed virtualenv with brew install pyenv-virtualenv
. I noticed that there was no folder named ~/.virtualenvs
so I made one and ran the command export WORKON_HOME=~/.virtualenvs
.
I ran the steps:
export PATH=/Users/<myusername>/.pyenv/shims:$PATH
pyenv install 3.10.1
pyenv global 3.10.1
pyenv rehash
pyenv virtualenv 3.10.1 test1
(which gave no output, and the folder .virtualenvs remained empty)
export WORKON_HOME=~/.virtualenvs
source ~/.pyenv/shims/virtualenvwrapper.sh
The terminal then crashes and vanishes. I had to do a screen recording to get the error. This still is from a video of the vscode terminal crashing.
I am using a 2021 MacBook M1 Pro running Monterey
What's the problem here?
Solution
I figured out how to run this environment, some of my steps were correct but I missed a few things.
So these are the correct install steps:
brew install pyenv
brew install virtualenv
brew install virtualenvwrapper
Then install the python version in pyenv, set it to global, and make sure your path sees this version of python first:
pyenv install 3.10.1
pyenv global 3.10.1
export PATH=/Users/myusername/.pyenv/shims:$PATH
(keep in mind that you need to do this last command every time you start up another shell if you want your path to see the pyenv version of python first, unless you add the command to your .zshrc file)
Then
pyenv virtualenvwrapper
(this is required for your terminal to see the virtualenvwrapper based commands)
mkvirtualenv my_venv
That should create the virtualenv in a way that is familiar with what you're used to using virtualenvwrapper. To activate this virtualenv in future sessions do:
pyenv virtualenvwrapper
workon my_venv
and to deactivate this environment simply type deativate
Answered By - ChristianOConnor Answer Checked By - Willingham (WPSolving Volunteer)