Skip to content

Pyenv 2.0 virtualenv can't be loaded into zsh shell anymore #1947

@houmie

Description

@houmie

Hello,

Pyenv was once so easy to install. Sadly the latest version has tainted this experience and made this so unnecessarily frustrating.

I'm on Mac M1 and when I try to pyenv activate v395 I get this error:

Failed to activate virtualenv.

Perhaps pyenv-virtualenv has not been loaded into your shell properly.
Please restart current shell and try again.

vim ~/.zshrc

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"

The documentation is outdated and is misleading, I don't think eval "$(pyenv init -)" is allowed anymore.
https://github.com/pyenv/pyenv-virtualenv#installing-with-homebrew-for-macos-users

I have source ~/.zshrc but it doesn't help.

➜  ~ pyenv --version
pyenv 2.0.0

➜  ~ pyenv-virtualenv --version
/opt/homebrew/bin/pyenv-virtualenv: line 106: pyenv-version-name: command not found
/opt/homebrew/bin/pyenv-virtualenv: line 141: pyenv-prefix: command not found
pyenv-virtualenv 1.1.5 (virtualenv unknown)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions