Use pyenv For Virtual Environments

November - 2021

NOTE: Not really using this since it requires setting up something in the shell that slows down the return of the command line each time

using the built in venv instead. from python3 that was installed by homebrew

OLD Notes:

Got notes from this article, it's basically how you did the setup.

Script to create new project they have is:

mkdir $2 && cd $2 && pyenv local $1 && pyenv virtualenv venv-$2 && pyenv local venv-$2 && pyenv activate venv-$2

Where you pass a python version and a name to create the directory and project, of course, that doesn't deal with git

The manual way to do it is

cd ~/git-repos git init --bare project_name cd ~/dev git clone ~/git-dev/project_name cd project_name

add .gitignore


pyenv virtualenv 3.9.4 venv_project_name pyenv local venv_project_name

For PyCharm, just open the new directory, don't make a new project.

Note sure if you need that first local since you're setting it to the venv later.

Note, this is what's in the article, but I it look like you don't need the pyenv local 3.9.0 or pyenv activate venv_project_name commands so you removed them above.

mkdir project_name cd project_name pyenv local 3.9.0 pyenv virtualenv 3.9.0 venv_project_name pyenv local venv_project_name pyenv activate venv_project_name

tagging this with pyvenv in case you accidentally search for that.