Environment construction with anyenv + pyenv (migrate from pyenv only (Mac))

What to write

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)

Install anyenv

% 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!

Install pyenv

% 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

Check pyenv

% 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

reference

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

Environment construction with anyenv + pyenv (migrate from pyenv only (Mac))
Environment construction with pyenv and pyenv-virtualenv
Python3 TensorFlow environment construction (Mac and pyenv virtualenv)
Python explosive environment construction starting from zero (Mac)
From Python environment construction to virtual environment construction with anaconda
Anaconda-4.2.0-python3 environment construction (Mac)
pyenv + fish environment construction
Mac environment construction Python
Pyxel environment construction (Mac)
From Kafka to KSQL --Easy environment construction with docker
ML environment construction with Miniconda
Python environment construction For Mac
Ansible environment construction For Mac
Python environment construction on Mac (pyenv, virtualenv, anaconda, ipython notebook)
OpenJTalk on Windows10 (Speak Japanese with Python from environment construction)
From environment construction to deployment for flask + Heroku with Docker
Get started with Python! ~ â‘  Environment construction ~
How to rebuild python environment from pyenv on Mac environment (El Capitan)
Anaconda environment construction on Mac (2018 version)
I checked Mac Python environment construction
Easy Jupyter environment construction with Cloud9
Python environment construction memo on Mac
Python environment construction (pyenv, anaconda, tensorflow)
Environment construction memo of pyenv + conda
Environment construction of python3.8 on mac
Automate environment construction with Shell Script
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
From Ubuntu 20.04 introduction to environment construction
Python3 TensorFlow for Mac environment construction
Using Chainer with CentOS7 [Environment construction]
pytorch @ python3.8 environment construction with pipenv
From PyCUDA environment construction to GPGPU programming on Mac (MacOS 10.12 Sierra)
Data science environment construction with Docker
Prepare the development environment with anyenv
Deep learning tutorial from environment construction
Realize environment construction for "Deep Learning from scratch" with docker and Vagrant
Create a Python3 environment with pyenv on Mac and display a NetworkX graph
[Pyenv] Building a python environment with ubuntu 16.04
Mac OS X Mavericks 10.9.5 Development environment construction
[Python] Building an environment with Anaconda [Mac]
Use smbus with python3 under pyenv environment
Vue.js + Flask environment construction memorandum ~ with Anaconda3 ~
Build Python environment with Anaconda on Mac
Use Anaconda-Python installed with pyenv from openFrameworks
Mac OS X Yosemite 10.10 Development environment construction
Mac OS X development environment construction memo
Build a python virtual environment with pyenv
A memo packed with RADEX environment construction
[Windows 10] "Deep Learning from scratch" environment construction
[mac] Install R in pyenv + Jupyter-Lab environment
Let's get along with Python # 0 (Environment construction)
Notes from installing Homebrew to building an Anaconda environment for Python with pyenv
Ubuntu 16.04 LTS, beginner memorandum of environment construction to switch anaconda version with pyenv
Try creating a web application with Vue.js and Django (Mac)-(1) Environment construction, application creation
[Memorandum] Discord distribution environment built only with Linux
Environment construction with VSCode + Remote Container (Go / Application)
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
MacOS 10.11 environment construction: Powerline with Anaconda and Dein.vim
From Kivy environment construction to displaying Hello World
Build python environment with pyenv on EC2 (ubuntu)
Use multiple versions of python environment with pyenv