0

It seems no matter how I try to conquer PyEnv running with 3.8.12 it still wants to run with 2.7

enter image description here

I'm out of ideas on how to get this to accurately reflect the Python environment version of 3.8.12.

Heats
  • 123
  • 1
  • 3
  • 10
  • it should be available from `pyenv which python` – salparadise Jan 03 '22 at 22:02
  • have you set the python version on the PATH environment variable? – NuMa Jan 03 '22 at 22:09
  • export PYENV_ROOT="$HOME/.pyenv" export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true" export PATH="$PYENV_ROOT/bin:$PATH" if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" pyenv virtualenvwrapper_lazy fi eval "$(pyenv virtualenv-init -)" export PATH="/usr/local/opt/openssl@1.1/bin:$PATH" – Heats Jan 03 '22 at 22:34
  • @NuMa this what I have for the path above. Maybe that's overkill and I need something less? This is what I have for my local bash and I can install fine - this is someone else's install I'm trying to get to work now :( – Heats Jan 03 '22 at 22:54
  • @9769953 brew install pyenv – Heats Jan 03 '22 at 23:26
  • @9769953 I'm storing the PATH variables above in .zprofile maybe I should move them to another file? – Heats Jan 03 '22 at 23:39

1 Answers1

2

Since you are using Homebrew, it is likely that $PYENV_ROOT/bin (i.e., /Users/<account>/.pyenv/bin) is empty, or even non-existent. That doesn't really matter, since the pyenv executable is probably on your path, e.g. somewhere in /usr/local/bin. Just in case, you can simply link it anyway:

mkdir -p $PYENV_ROOT/bin
cd $PYENV_ROOT/bin
ln -s /usr/local/bin/pyenv
cd

But, that will likely not matter, nor solve your issue.


What you probably forget, is the line

eval "$(pyenv init --path)"

in $HOME/.zprofile, as mentioned in the GitHub README of the project (search for "zprofile").
Just add the line, creating the file if necessary.

The line

eval "$(pyenv init --)"

should also be used, but in $HOME/.zshrc. I see this line in your comment, but apparently in .zprofile (inside an if-statement). Perhaps that will work, perhaps you need to move it to .zshrc.

Now restart the terminal (or just source ~/.zprofile, or even paste the line directly into the terminal for a one-off local session use), and you should be good to go.


Note that it looks like the pyenv initialisation has been simplified: no need for the if-statement anymore. For details, I refer again to the GitHub README of the project.

9769953
  • 10,344
  • 3
  • 26
  • 37
  • Thank you! That did the trick I can now activate a pyenv virtualenv with 3.8.12 and it is reflected as such. Running into a different issue now but I'll open a new question for that. Appreciate you! – Heats Jan 04 '22 at 03:13