LoginSignup
1
2

More than 3 years have passed since last update.

environment

  • Macos Catalina 10.15.1

install & check folder

$ brew install pyenv
$ cd ~/.pyenv

you can also install by git

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
1
2
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
1
2