Updating the OS to Catalina recommends migrating from bash to zsh. Here, if you move to zsh, pyenv will not work as it is.
If you display the version with pyenv, it will certainly come out.
% pyenv versions
system
3.6.5
3.6.5/envs/3.6.5_tensorflow_cpu
3.6.5_tensorflow_cpu
* 3.7.4
The currently set python environment should be 3.7.4.
% pyenv local
3.7.4
However, when I run it, the system python comes up.
% python
WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.
Python 2.7.16 (default, Nov 9 2019, 05:55:08)
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.32.4) (-macos10.15-objc-s on darwin
Type "help", "copyright", "credits" or "license" for more information.exit
When using with sh, it is necessary to write the setting in .zshenv or .zshrc.
Add the following line to restore pyenv.
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
Start .zshrc in an editor and
vim ~/.zshrc
I'll add the previous line. And if you source and reload it, it's okay
source ~/.zshrc
Try to start Python
% python
Python 3.7.4 (default, Sep 28 2019, 14:11:05)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
The python environment has come up as expected! !!
Recommended Posts