3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyenvでPythonのバージョンを切り替えられない場合

Posted at

pyenvでPythonのバージョンを切り替えられない場合【MacOS Mojave】

今回、pyenvでpythonのバージョンを切り替えられない理由は、
MacOS Mojaveにありました!

$ pyenv global 3.6.5

とすると、

pyenv: version `3.6.5' not installed

と出てしまう。
そこで

$ pyenv install 3.6.5

としたものの、

pyenv: version `install' not installed

とまたまたエラー。

$ pyenv install --list

ここにはきちんと一覧に載っているのだが、、、
xcode-selectの最新バージョン(2354)にMojave用のmacOS SDK headerがデフォルトで入っていないのが原因のようなので、

$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

これを実行して、再び!

$ pyenv install 3.6.5

OK!
High Sierra以前ではこれは基本的にxcode-select --install で直せたが、Mojaveではそう上手く行かないよう。

そして最後に

$ pyenv global 3.6.5
$ python --version                                                                                             
Python 3.6.5

できました!

3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?