Pyenv-virtualenv not loaded into shell properly & .zshrc
19:25 16 May 2020

I am a first-time pyenv user. I have been following this installation article on Medium. I must have messed up a step because I get an error. I have gone over and over it again but cannot seem to find it. So maybe someone can help me.

Heads up, I think I might have bombed it because midway I decided to move from bash to .zsh. I provide the errors I get. When I write:

% pyenv local venv-project && pyenv activate venv-project

The error that pops up is:

Failed to activate virtualenv.

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

On my home directory I have the following files:

-rw-------   1 diego  staff   1786 May 16 14:57 .bash_history
-rw-r--r--   1 diego  staff    544 May 16 15:16 .bash_profile
drwx------  13 diego  staff    416 May 16 14:57 .bash_sessions
drwxr-xr-x   6 diego  staff    192 May 16 17:04 .pyenv
-rw-------   1 diego  staff   1532 May 16 17:24 .zsh_history
-rw-r--r--   1 diego  staff    718 May 16 17:24 .zshrc

The .zshrc document did not exist when I installed .zsh, so I created it. At first I read online that I could write source ~/.bash_profile to direct the file to .bash_profile but that did not work. So I decided to copy and paste what was on .bash_profile into .zshrc as the complete rookie I am. Anyway, so I did that and it did not work. I decided to change things to look like the screenshot from the article I mention above and ended up with this:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/diego/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/diego/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/Users/diego/opt/bin:$PATH"
        #export PATH="/Users/diego/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup

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

I think I just messed it up and truly do not know where to go from here. Now every time I open the terminal it says:

/.zshrc:export:18: not valid in this context: /Users/diego/.pyenv

Any suggestions or explanations on the different places where I went wrong?

Thanks in advance!

bash zsh pyenv