[PYTHON] pyenv Simply the main points

Development environment

Linux kernel 4.15.0-54-generic

reference

This was helpful!

Get pyenv

This time, we will place pyenv in the home directory, but as long as you pass the path correctly, you can place it anywhere.

Get pyenv from git


git clone https://github.com/pyenv/pyenv.git ~/.pyenv

Other things that make you happy if you put them in


sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils libffi-dev

Pass the pass so that you can use it

I don't use ʻecho >>`, so I recommend the first method.

Method ① Add the following to ~ / .bashrc (~ / .bash_profile)

#pyenv settings
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

Method 2 Execute echo >> in the terminal

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
 echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"
pyenv -v

How to use

install python

Get a list of pythons you can install


pyenv install -l

Installation


pyenv install 3.6.9

version control

Version confirmation

pyenv versions
system
*3.6.9 ← View that this is the current version
3.7.5

Version switching

When you want to use the whole system


pyenv global version number

When you want to use it only in the directory


pyenv local version number

Know the full path of python

What's good with the normal which command pyenv will push the location of the selected python.

When system is selected


pyenv versions
*system
3.6.9

location


which python
> /home/osorezugoing/.pyenv/shims/python

Recommended Posts

pyenv Simply the main points
Pipenv Simply the main points
Raise the version of pyenv itself
Detect mosaic points in the image
In the python command python points to python3.8
Simply view the Jupyter notebook file
About the size of matplotlib points
Summarize the main points of growth hacks for web services and the points of analysis