Using Your New Python
00:00
Let’s start by looking at the Python versions that are currently available with the pyenv versions
command.
00:08
As you can see by the asterisk (*
), system
Python is still enabled, so let’s change that. You can change the Python version with the pyenv global
command.
00:19
So, let’s run pyenv global 3.9.1
and check the current Python version, after which you will see that it is set. And when you want to turn back to system Python, just run pyenv global system
, check the current python
version, and you will see that you are back to using system Python.
00:46 You can now switch between different versions of Python with ease, but this is just the tip of the iceberg. If you have many versions that you want to switch between, typing these commands consistently will be tedious. We just touched the basics and later on in this course, you will learn more convenient ways to manage your Python versions.
01:11
In the next lesson, we’ll have a look at some pyenv
commands.
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
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)";
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.
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
What could be the problem?