#environment
- Macos Catalina 10.15.1
#install & check folder
$ brew install pyenv
$ cd ~/.pyenv
#list packages and install python3.6.7 python3.6.8
$ pyenv install -l
$ pyenv install 3.6.7 3.6.8
$ pyenv versions
* system(set by /Users/xxxx/.python-version)
3.6.7
3.6.8
#create virtual environment
pyenv virtualenv python_version environment_name
$ pyenv virtualenv 3.6.7 environ_3.6.7
$ pyenv versions
system
3.6.7
3.6.7/envs/environ_3.6.7
environ_3.6.7
...
#delete virtual environment
$ pyenv uninstall environ_3.6.7
$ pyenv versions
system
3.6.7
...
#change global python version
pyenv global python_version[or python_virtual_environment]
$ pyenv global environ_3.6.7
(environ_3.6.7) xxxxxx:~ user$
$ python -V
Python 3.6.7
$ cd ~/.pyenv
$ vi version
environ_3.6.7
#if you delete this "version" file, the global python will change to system python
#switch to environment
pyenv local python_version[or python_virtual_environment]
$ pyenv local 3.6.8
(3.6.8) xxxxxx:~ user$
$ python -V
Python 3.6.8