• Uncategorized

About python : Trying-to-Install-3812-Python-and-It-Keeps-Using-27

Question Detail

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

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

Question Answer

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

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.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.