How to change from pyenv-only environment to anyenv + pyenv environment (Uninstall pyenv, install anyenv + pyenv) Nothing new (for myself)
pyenv→anyenv+pyenv In conclusion, remove pyenv and install anyenv, install pyenv with anyenv and recreate the required environment According to here, it was written that a problem would occur if you simply moved the folder, so I decided to delete it and recreate it. did.
Check and delete what you installed with pyenv
% pyenv versions
%pyenv uninstall What to remove
Then uninstall pyenv
% brew uninstall pyenv
I think there is a description of the following 3 lines in .zprofile, so delete or comment out (commented out as below)
#export PYENV_ROOT="$HOME/.pyenv"
#export PATH="$PYENV_ROOT/bin:$PATH"
#eval "$(pyenv init -)"
Also, there is a hidden folder called .pyenv in / User / username /, but I don't need it anymore, so delete it. (Let's clean up the problem even if it remains)
% brew install anyenv
Add the following to .zprofile
% echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.zprofile
% echo 'eval "$(anyenv init -)"' >> ~/.zprofile
When you restart the terminal, you will be told as follows
% source ~/.zprofile
ANYENV_DEFINITION_ROOT(/Users/username/.config/anyenv/anyenv-install) doesn't exist. You can initialize it by:
> anyenv install --init
follow orders.
% anyenv install --init
Manifest directory doesn't exist: /Users/username/.config/anyenv/anyenv-install
Do you want to checkout ? [y/N]: y
Cloning https://github.com/anyenv/anyenv-install.git master to /Users/username/.config/anyenv/anyenv-install...
Cloning into '/Users/username/.config/anyenv/anyenv-install'...
remote: Enumerating objects: 48, done.
remote: Total 48 (delta 0), reused 0 (delta 0), pack-reused 48
Receiving objects: 100% (48/48), 6.66 KiB | 3.33 MiB/s, done.
Resolving deltas: 100% (2/2), done.
Completed!
% anyenv install pyenv
/var/folders/s5/67jvmwk14ss73fj1x4368sym0000gn/T/pyenv.20200815051616.35266 ~
Cloning https://github.com/pyenv/pyenv.git master to pyenv...
Cloning into 'pyenv'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 18140 (delta 0), reused 3 (delta 0), pack-reused 18133
Receiving objects: 100% (18140/18140), 3.62 MiB | 2.63 MiB/s, done.
Resolving deltas: 100% (12334/12334), done.
~
Install pyenv succeeded!
Please reload your profile (exec $SHELL -l) or open a new session.
Follow the instructions and restart the shell as follows
% exec $SHELL -l
% pyenv versions
* system (set by /Users/username/.anyenv/envs/pyenv/version)
% pyenv install 3.7.8
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.8.tar.xz...
-> https://www.python.org/ftp/python/3.7.8/Python-3.7.8.tar.xz
Installing Python-3.7.8...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.7.8 to /Users/username/.anyenv/envs/pyenv/versions/3.7.8
% pyenv global 3.7.8
% python
Python 3.7.8 (default, Aug 15 2020, 05:17:58)
[Clang 11.0.3 (clang-1103.0.32.59)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
It is switching properly
https://note.com/digiangler777/n/n16c2853e7287 https://qiita.com/kai_kou/items/f54931991a781b96bb9c https://qiita.com/koooooo/items/b21d87ffe2b56d0c589b https://stangler.hatenablog.com/entry/2019/01/18/161956
Recommended Posts