You shall not use
pyenv manages environments per user, not system-wide.
Do first.
Can look first eg
For Bash (~/.bashrc):
sudo
with pyenv.pyenv manages environments per user, not system-wide.
Do first.
sudo pyenv uninstall 2.7.18Here a example if i do it.
# Check version tom@tom-VirtualBox:~$ pyenv --version pyenv 2.4.1-6-g56956e9d # Now Python version tom@tom-VirtualBox:~$ python -V Python 3.11.3 # Install 2.7.18 tom@tom-VirtualBox:~$ pyenv install 2.7.18 pyenv: /home/tom/.pyenv/versions/2.7.18 already exists continue with installation? (y/N) y Downloading Python-2.7.18.tar.xz... ..... Installed Python-2.7.18 to /home/tom/.pyenv/versions/2.7.18 # Switch to 2.7.18 tom@tom-VirtualBox:~$ pyenv global 2.7.18 # Test that it work tom@tom-VirtualBox:~$ python -V Python 2.7.18 tom@tom-VirtualBox:~$ python Python 2.7.18 (default, Mar 18 2022, 14:15:22) [GCC 7.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>Also make sure that shell configuration is ok.
Can look first eg
nano ~/.bashrc
or vi ~/.bashrc
# pyenv setup, can place last in file export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv init -)"If not ok code under will add lines needed or can manually edit in editor over.
For Bash (~/.bashrc):
echo -e '\n# pyenv setup\nexport PATH="$HOME/.pyenv/bin:$PATH"\neval "$(pyenv init --path)"\neval "$(pyenv init -)"' >> ~/.bashrc source ~/.bashrcFor Zsh (~/.zshrc):
echo -e '\n# pyenv setup\nexport PATH="$HOME/.pyenv/bin:$PATH"\neval "$(pyenv init --path)"\neval "$(pyenv init -)"' >> ~/.zshrc source ~/.zshrc