LoginSignup
2
0

More than 1 year has passed since last update.

pyenvで.python_versionを設定していてもPythonのバージョンが切り替わらないとき

Posted at

「pyenvで.python_versionを設定していてもPythonのバージョンが切り替わらないとき」とはこんな時です。

$ ls
.python_version

$ cat .python_version
3.9.8

$ pyenv global 3.9.8

$ python -V
Python 3.10.3

pyenv versionsを実行します。

$ pyenv versions
  system
  2.7.13
  3.10.1
* 3.10.3 (set by PYENV_VERSION environment variable)
  3.6.4
  3.9.8
$ $PYENV_VERSION                                                      
zsh: command not found: 3.10.3

環境変数PYENV_VERSION3.10.3が設定されていました。これをpyenvが優先して読み込んでいるようです。この環境変数をunsetします。

$ unset PYENV_VERSION
$ pyenv versions
  system
  2.7.13
  3.10.1
  3.10.3
  3.6.4
* 3.9.8 (set by /foo/bar/.python_version)
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0