Answer the question
In order to leave comments, you need to log in
Why doesn't pyenv activate the environment with the new python interpreter (Ubuntu 20.04.3 LTS)?
Before installing docker and docker-compose on the machine, the command to check the python 3 version seems to work through an alias:
python -V -> Python 3.8.10
After installing the alias, it stopped working, now the command looks like this:
python -V -> Команда «python» не найдена...
python3 -V -> Python 3.8.10
# ---PYENV---
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv virtualenv 3.7.7 env_project
(env_project) [email protected]:~/path1/path2/path3/3_7_7$
(env_project) [email protected]:~/path1/path2/path3/3_7_7$ python -V -> Команда «python» не найдена...
(env_project) [email protected]:~/path1/path2/path3/3_7_7$ python3 -V -> Python 3.8.10
(env_project) [email protected]:~/path1/path2/path3/3_7_7$ pyenv which python -> /home/user-name/.pyenv/versions/env_project/bin/python
(env_project) [email protected]:~/path1/path2/path3/3_7_7$ pyenv which python3 -> /home/user-name/.pyenv/versions/env_project/bin/python3
source "/home/user-name/.pyenv/versions/env_project/bin/activate"
python -V -> Python 3.7.7
pyenv shell env_project
(env_project) [email protected]:~/path1/path2/path3/3_7_7$
pyenv shell env_project
(env_project) [email protected]:~/path1/path2/path3/3_7_7$ python -V -> Команда «python» не найдена...
(env_project) [email protected]:~/path1/path2/path3/3_7_7$ python3 -V -> Python 3.8.10
Answer the question
In order to leave comments, you need to log in
Found a solution.
As it turned out, you need to add an additional line to the .bashrc configuration file , which is not in the installation documentation:
# ---PYENV---
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)" # <- Без нее почему-то не работало
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question