Linux kernel 4.15.0-54-generic
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
I don't use ʻecho >>`, so I recommend the first method.
#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
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
Get a list of pythons you can install
pyenv install -l
Installation
pyenv install 3.6.9
pyenv versions
system
*3.6.9 ← View that this is the current version
3.7.5
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
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