0

I am trying to update from Python 2.7.17 to 3.8.1 so that I can run pip install pandas. I have installed pyenv, followed the instructions to add pyenv to my path, and installed 3.8.1. But every time I run python, it will not use version 3.8.1.

Running pyenv version returns 3.8.1, running python -V returns 2.7.17. Similarly, running python runs 2.7.17, and when I type python3 it runs Python 3.7.6?! But if I run pyenv global 3.7.6 the terminal tells me that 3.7.6 isn't installed!

I have also run pyenv global 3.8.1 in attempt to switch from 2.7.17 so 3.8.1, but still defaults to 2.7.17 when I type python.

I am using Ubuntu on Windows 10, if that helps. Any help is greatly appreciated -- I am very very confused. Thanks in advance.

Machavity
  • 30,841
  • 27
  • 92
  • 100
amb
  • 27
  • 6
  • The python 3.7.6 error is because you have not installed it with pyenv. You should run ```ls ~/.pyenv/versions/``` to verify the avaible installed versions that you could use with pyenv and ```pyenv install --list | grep " 3\.[6789]"``` to see all the avaible python 3.6+ versions that you can install with pyenv. – Miguel Trejo Feb 04 '20 at 04:13
  • Also, after you run ```pyenv global 3.8.1``` you can verify that Python version you just installed is working with ```python -m test```. – Miguel Trejo Feb 04 '20 at 04:19

1 Answers1

0

You could just use

pyenv shell 3.8.1

to set the PYENV_VERSION environment variable to the desired 3.8.1 version. But, I recommend you to use a virtual env:

pyenv virtualenv 3.8.1 my_test_env

and the activate it with:

pyenv activate my_test_env

For more info, this guide is super useful.

Miguel Trejo
  • 5,913
  • 5
  • 24
  • 49