[PYTHON] Summary of pyenv usage

Recently, I'm using python with pyenv, but it was difficult to find out how to use pyenv / pyenv-virtualenv every time, so make a note.

pyenv installation for mac

Package installation

$ brew install pyenv
$ brew install pyenv-virtualenv

Add settings

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile

Summary of how to use pyenv

Check the list of installable versions

 $ pyenv install --list

Installation

$ pyenv install 3.5.1

Check the current version

$ pyenv version

Check the list of installed versions

$ pyenv versions

Setting the version to be used as a whole

$ pyenv global 3.5.1

Setting the version to be used only under a specific directory

$ cd PROJECT_DIR
$ pyenv local 2.7.11
$ pyenv version
Python 2.7.11
$ cd ..
$ pyenv version
Python 3.5.1

Summary of how to use pyenv-virtualenv

Create virtualenv by specifying the version

$ pyenv virtualenv 2.7.11 sandbox27

Create virtualenv with current version

$ pyenv version
Python 3.5.1
$ pyenv virtualenv sandbox35

Check for existing virtualenv

$ pyenv virtualenvs

Enable virtualenv

$ pyenv activate <name>

Disable virtualenv

$ pyenv deactivate

Recommended Posts

Summary of pyenv usage
Convenient usage summary of Flask
pyenv summary
Basic usage of Pandas Summary
pytest usage summary
Numerical summary of data
Summary of Tensorflow / Keras
Basic usage of flask-classy
Basic usage of Jinja2
Usage of Python locals ()
Basic usage of SQLAlchemy
Summary of string operations
Summary of Python arguments
Summary of logrotate software logrotate
Summary of test method
Python --Explanation and usage summary of the top 24 packages
pandas Matplotlib Summary by usage
[Python] Correct usage of map
Mechanism of pyenv and virtualenv
Super basic usage of pytest
Summary of python file operations
2017.3.6 ~ 3.12 Summary of what we did
Basic usage of PySimple GUI
Summary of Linux distribution types
Coexistence of pyenv and autojump
Pipenv usage summary (for myself)
Introduction of caffe using pyenv
(Minimal) usage of django logger
Sample usage of Python pickle
Basic usage of Python f-string
A brief summary of Linux
[Python] Correct usage of join
Index of certain pandas usage
Summary of Proxy connection settings
Raise the version of pyenv itself
Summary of how to use pandas.DataFrame.loc
Summary of basic knowledge of PyPy Part 1
Summary of basic implementation by PyTorch
Summary of scraping relations (selenium, pyautogui)
A brief summary of Python collections
H29.2.27 ~ 3.5 Summary of what I did
Summary of Stack Overflow Developer Survey 2020
Easy usage memo of Anaconda (conda)
Summary of how to use pyenv-virtualenv
Machine learning ③ Summary of decision tree
Summary of various operations in Tensorflow
Environment construction memo of pyenv + conda
A rough summary of OS history
A brief summary of qubits (beginners)
Summary of go json conversion behavior
Installation and easy usage of pytest
A Tour of Go Learning Summary
[python] Correct usage of if statement
Summary of "nl command Advent Calendar 2020"
[Anaconda3] Summary of frequently used commands
Summary of how to use csvkit
[For competition professionals] Summary of doubling
Summary of Python indexes and slices
Summary of multi-process processing of script language
Summary of restrictions by file system
[OpenCV; Python] Summary of findcontours function