Specify python version when creating a new virtual-environment using pyenv-virtualenvwrapper and change the version afterwards

157 Views Asked by At

As far as I've understood, with the homebrew-installed pyenv-virtualenvwrapper I can create a new virtual environment via the command mkvirtualenv proj_name independently of the current working directory in the terminal where I'm executing the command. I.e., I assume I don't have to do cd /path/to/proj_name before executing mkvirtualenv proj_name.

Still, what I was wondering is how to choose the local python version of this very project, since if I used pyenv virtualenv the syntax allows for specifying the exact python version for that very project like so: pyenv virtualenv 3.9.0 proj_name

What I did was going into the project folder via cd /path/to/proj_name and executed pyenv local 3.9.0 before creating the virtual environment (venv) via mkvirtualenv proj_name, but I'm not sure whether this had an effect at all.

How will the python version for the new project venv created via pyenv-virtualenvwrapper be chosen, and can it be changed for that specific venv later on?


OS:

Description: Lubuntu 20.04.1 LTS, Release: 20.04, Codename: focal

0

There are 0 best solutions below