Skip to content

Virtualenvwrapper creates virtual env with wrong python interpreter #44

@valentingregoire

Description

@valentingregoire

In Ubuntu 22.04 using zsh, I get this weird behavior. I have pyenv installed with a Python 3.8.10 shim installed. I have this config in my .zshrc:

#virtualenvwrapper
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=~/.pyenv/shims/python
source $HOME/.local/bin/virtualenvwrapper.sh

The shim is pointing to the correct location:

~/.pyenv/shims/python --version
Python 3.8.10

Yet, when I create a virtual environment, I receive this output (this is only a fragment):

❯ mkvirtualenv a
created virtual environment CPython3.10.6.final.0-64 in 76ms
...

When I activate the environment and ask for the python version, I get this:

❯ python --version
Python 3.10.6

When I debug the virtualenwvrapper.sh, I see that the very beginning of the script is fetching the location of the python installation. When I put an echo after that little block of code, I see this as an output:

before setting VIRTUALENVWRAPPER_PYTHON: /home/valentin/.pyenv/shims/python
after setting VIRTUALENVWRAPPER_PYTHON: /home/valentin/.pyenv/shims/python

I don't understand that my virtual envs are pointing tot Python 3.10.6 while everything is pointing to 3.8.10. What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions