Not able to get python version even after setting pyenv global version
Asked Answered
W

1

6

I have installed pyenv-win for windows, also removed the normal python path from PATH environment variable.

Then, I have installed 2 versions of python(3.6.8 and 3.8.0) using "pyenv install ". enter image description here

Applied pyenv global version as running the command "pyenv global 3.6.8", when I run "pyenv versions", it is showing 3.6.8 is the global version.

But when I run "python --version" nothing is getting displayed and so I can't run any python file". I have also run "pyenv rehash" as well. Also, I have added /.pyenv/pyenv-win/shims and bin as well in the PATH environment variable.

I need your help here. Any leads would be appreciated, thank you.

Willman answered 31/10, 2020 at 15:20 Comment(5)
Did you run github.com/pyenv-win/pyenv-win#finish-the-installationVaduz
yes @StefanWang, I am able to check "pyenv --version" and also "pyenv rehash", but not sure what rehash is doing, it is not returning anything, and also it completes very quickly.Willman
ohh !!, now, it's working. But, I really did that because earlier also "pyenv versions" and "pyenv rehash" were working for me and also was able to set global version, the only issue is when I run "python --version" nothing comes. But now it is working, all I did is just ran the "follow the installation" steps again. Thank you @StefanWangWillman
nice to hear thatVaduz
For me a restart of the shell I was working in did the trick. Somehow the global instruction didn't take effect before.Warrantor
T
3

I think that you sould disable some aliases (see step n°3)

Here is how I installed pyenv-win, i had the same issue:

1 - Uninstall Python (your current version when you type the command python -V)

2 - Install pyenv-win and add it to the PATH (here are some optional steps to install it via chocolatey, which adds it directly to the PATH)

2.2 - Install chocolatey

2.3 - In an administrator powershell run: choco install pyenv-win

3 - Start menu (windows key) -> Manage application execution aliases -> disable aliases related to python here it's in french but it should be similar

4 - install the desired python version via pyenv: pyenv install DESIRED VERSION NUMBER

5- run pyenv rehash

6 - set it as global pyenv global DESIRED VERSION NUMBER

7 - you sould see the desired version by running the command python -V

Turf answered 15/6, 2021 at 13:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.