I wanted to put the execution PATH in Python of pyenv, but the known method didn't work at all, that is, I got stuck and melted it for a day. This happened when I did the following:
which python
to change to /Users/USERNAME/.pyenv/shims/python
./ usr / bin / python
, which was the default for Mac. .. ..So, the story of re-pathging python's PATH to /Users/USERNAME/.pyenv/shims/python
. It's inconvenient because the version of python doesn't change.
Since I used zsh, the following settings are of course in .zshrc. (Reference: https://github.com/pyenv/pyenv)
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Theoretically, if you do source .zshrc
, your PATH should definitely go through. .. ..
When I check it. .. ..
$ which python
/usr/bin/python
Huh ?? FUCK !!! I didn't go there! !!
Hmm, that's it. Isn't the order of PATH wrong?
$ vim /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Properly, the order of / usr / local / bin
does not come first. .. .. ..
By the way, if / usr / bin
comes first, that executable file will be in the PATH preferentially.
If this happens, uninstall pyenv due to brain death and reinstall it.
Even if you just do brew uninstall pyenv
, there are configuration files here and there, so
I crushed everything by referring to the following article.
https://qiita.com/yasudadesu/items/1177aa93229e7c4b7a45
So, even if I soruce .zshrc
the .zshrc again, it still doesn't heal. .. ..
Yes, I gave up.
A great thank you to the article for someone who caused a similar event. https://dev.classmethod.jp/articles/pyenv-command-not-found/
The point is that you should try reassociating the links.
$ brew unlink pyenv
$ brew link pyenv
$ source .zshrc
Please come. .. .. Check Python's PATH with prayer.
$ which python
/Users/USER NAME/.pyenv/shims/python
I did it! !! !!
The ancestor is great
Recommended Posts