
Macに入れているpyenvでバージョンを切り替えることができなくなった
公式ドキュメントを見てみる
pyenv init してね、と書いてある
pyenv init
# Load pyenv automatically by appending
# the following to ~/.zshrc:
eval "$(pyenv init -)"
言われたとおり、 ~/.zshrcにeval “$(pyenv init -)”を書いてみた
が、だめ
Choosing the Python Version
When you execute a shim, pyenv determines which Python version to use by reading it from the following sources, in this order:1.The
PYENV_VERSIONenvironment variable (if specified). You can use thepyenv shellcommand to set this environment variable in your current shell session.2.The application-specific
.python-versionfile in the current directory (if present). You can modify the current directory’s.python-versionfile with thepyenv localcommand.3.The first
.python-versionfile found (if any) by searching each parent directory, until reaching the root of your filesystem.4.The global
https://github.com/pyenv/pyenv#choosing-the-python-version$(pyenv root)/versionfile. You can modify this file using thepyenv globalcommand. If the global version file is not present, pyenv assumes you want to use the “system” Python. (In other words, whatever version would run if pyenv weren’t in yourPATH.)
pyenvのバージョン選択は
1.pyenv shellで設定できる環境変数のPYENV_VERSION
2.pyenv localで設定できるカレントディレクトリの.python-version
3.pyenv globalで設定できる~/.pyenv/version
4.全部当てはまらなかったらsystemのpython
という順番で行われているようだ
確認したところ、ホームディレクトリに.python-versionを発見
これを削除し、無事にpyenv globalで環境を変えることができるようになった


コメント