Local python version not changing after installing pyenv-win
Asked Answered
W

3

6

I've recently installed pyenv-win on my Windows machine using the pip documentation as I already had Python 3.8.5 installed on my machine. Having used pyenv to set the global version to 3.7.6:

  • Running pyenv which python returns C:\Users\Haydn\.pyenv\pyenv-win\versions\3.7.6\python.exe as expected
  • However, running python -V returns Python 3.8.5
  • and pip -V returns pip 20.2.2 from C:\Users\Haydn\AppData\Roaming\Python\Python38\site-packages\pip (python 3.8)

Installing other packages such as pipenv does so in the Python 3.8 folder and fails, as do projects requiring Python 3.7. I'm trying to work out what I could have done wrong or might not be working so that the pyenv 3.7 version is used over the system 3.8.


Everything seems to have progressed fine during installation:

  • pyenv --version returns pyenv 2.64.3
  • Environment variable PYENV is set to C:\Users\Haydn\.pyenv\pyenv-win\
  • C:\Users\Haydn\.pyenv\pyenv-win\bin & C:\Users\Haydn\.pyenv\pyenv-win\shims are added to the Path environment variable.

I don't know much about environment variables, but my suspicion is towards the fact that installing Python 3.7 using pyenv has not added anything to my Path variable (see screenshot), so when I call python it's just moving into the 3.8 folder as expected. I feel like pyenv should have added something here but that may not be how the package works and something else could very well be the cause.

screenshot of Path variable

Thanks in advance for your help

Wot answered 17/9, 2020 at 15:32 Comment(0)
A
5

Python installed path that was set in environment variables PATH seems override the pyenv-win configuration. If any Python installation directory was previously set in PATH try deleting it as pointed out in this: pyenv global interpreter not working on windows10

Arlenarlena answered 17/1, 2021 at 15:32 Comment(0)
H
4

I wanted to further @nhieckqo answer but don't have the required rep yet, so...

After deleting the paths entries from a system install of python3.9 via Windows Store, I also had to disable ALL aliases for python3.9 (not just App Installer as the pyenv github suggests).

See "NOTE" here:
https://github.com/pyenv-win/pyenv-win/tree/057ba9e97bc5f217ddcffc01768174495c78859a#finish-the-installation

Homogenesis answered 15/3, 2021 at 2:55 Comment(0)
R
2

pyenv rehash seem to do the trick for me. I've had similar issue where Path did not get pointed at proper python installation. Rehashing fixed the issue.

There was also other issue reported on pyenv-win github: https://github.com/pyenv-win/pyenv-win/issues/67 But that seem to be resolved already - rehash was actually an idea from there.

Rupertruperta answered 23/12, 2020 at 11:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.