Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Using Your New Python

Avatar image for Marc Andreu

Marc Andreu on April 14, 2022

Hello I am on Ubuntu 20.04 and I am just starting with pyenv. I had Python system 2.7, 3.8 and 3.9 installed.

It looks like py pyenv is not setting up the python version when I use pyenv global command.

This are the outputs of the commands after doing pyenv global 3.9.1

  ~ pyenv versions
  system
  3.10.4
* 3.9.1 (set by /home/user/.pyenv/version)
  ~ python -V
Python 2.7.18
  ~ python3 -V
Python 3.8.10
  ~ ls /bin/pyth*
/bin/python   /bin/python2.7  /bin/python3.8         /bin/python3.9
/bin/python2  /bin/python3    /bin/python3.8-config  /bin/python3-config

What could be the problem?

Avatar image for Geir Arne Hjelle

Geir Arne Hjelle RP Team on April 14, 2022

@Marc Andreu

Have you restarted your terminal after installing pyenv? It could be that paths are not yet properly set up. You may also need to manually add the initialization of pyenv to your .bashrc file, possibly with the change discussed here: github.com/pyenv/pyenv/issues/2198

Avatar image for Marc Andreu

Marc Andreu on April 14, 2022

Yes thanks Geir,

I have submitted a PR to fix the pyenv Readme file docs. github.com/pyenv/pyenv/pull/2326

I found the solution I had to modify the .zshrc from

eval "$(pyenv init --)";

to

eval "$(pyenv init --path)";
Avatar image for Geir Arne Hjelle

Geir Arne Hjelle RP Team on April 14, 2022

@Marc

Cool, hopefully the docs will work better for the next ones installing pyenv. Thanks for taking the time to submit the PR! 👏‍

Become a Member to join the conversation.