bug: Python version in .python-version is not used
Describe the bug After installing pyenv and setting version the system does not use the python version in .python-version
To Reproduce launch powershell
PS C:\Users\bbate> pyenv versions
* 3.7.9 (set by C:\Users\bbate\.python-version)
3.8.7
PS C:\Users\bbate> pyenv local
3.7.9
PS C:\Users\bbate> python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Expected behavior Python should use 3.7.9
Screenshots N/A
Desktop (please complete the following information):
- OS: Windows 10
- Tools used: Powershell
- V1.0
Additional context Add any other context about the problem here.
+1 @eafpres I've got the exatly same problem 😢
If I install pyenv with pyenv-installer on Windows 10 with WSL Ubuntu 20.04, and execute the same commands, works perfectly!!
Did you solve this?
Did you solve this?
I did not solve it, but I figured out how to do it without pyenv in Windows using Powershell.
I did not solve it, but I figured out how to do it without pyenv in Windows using Powershell.
I see :(
Thank you so much for your response @eafpres !! I will expect that any admin user help us with this.
For while, I've fixed only one Python version with .python-version file 😞
@eafpres
If you don't mind, could you explain your work around for this problem using Powershell? I have this exact same problem where the python version is unchanged even after setting pyenv global and local to different python versions.
Thanks!
@mfdeveloper hey thanks for response. @eafpres @Jiw0on check you Environment Path which I have described in the Installation here is the link
Hello @kirankotari ! Thank you so much for your response.
I checked my environment variables, and everything is ok like described in pyenv-win#finish-the-installation. Thus, I have the same problem if exists a python installation in my system
Hello @mfdeveloper!
Do you have another "system" (standalone) installed version of Python? Check your PATH order in 'Environment Variables': path to pyenv shims should be higher than another installed versions (via Microsoft Store or Chocolatey)

And try to change System variable PATH instead of User :) Because it works like a charm on my Windows host.
Helloo @hotenov !!
Thank you so much for this advice. I moved up the pyenv shims like you said and it works! However, I prefer uninstall the "system" Python installed by others sources (Chocolatey, downloaded from python.org...) and use only pyenv 😄
Maybe this "warning" should be on README.md or in a Wiki page like "Known issues". Or to automate this process, the pyenv-win could identify installed system versions and do that in PATH environment variable.
What do you think about it @kirankotari ?
I just did the vanilla pyenv-win install from the README on Windows, and also hit this same problem. After running the command per the instructions:
[System.Environment]::SetEnvironmentVariable('path', $env:USERPROFILE + "\.pyenv\pyenv-win\bin;" + $env:USERPROFILE + "\.pyenv\pyenv-win\shims;" + [System.Environment]::GetEnvironmentVariable('path', "User"),"User")
I found the pyenv-win\bin and pyenv-win\shims env variables specified on a user basis, which makes sense. However, the system Python path was still winning out. I read all over the README and found no instructions on this. I had to manually add those environment variables to my system environment variables as @hotenov instructed above.
I think pyenv-win should at least have this documented somewhere in the README.
Helloo @hotenov !!
Thank you so much for this advice. I moved up the pyenv shims like you said and it works! However, I prefer uninstall the "system" Python installed by others sources (Chocolatey, downloaded from python.org...) and use only pyenv 😄
Maybe this "warning" should be on
README.mdor in a Wiki page like "Known issues". Or to automate this process, thepyenv-wincould identify installed system versions and do that inPATHenvironment variable.What do you think about it @kirankotari ?
@hotenov thanks a lot for the image and explanation, @hotenov @mfdeveloper @jamesbraza I have started the Wiki home page, there is a option to clone it and contribute to the community, we are happy for your contributions. wiki link
@kirankotari , Hi! I would like to contribute and add this wiki page (if others don't mind =). Give me a couple of days. I'll check all steps on clean installation (because it was a year ago and some bugs were fixed, including multiple versions in .python-version file).
@kirankotari Hello again! Wiki page is ready, but I have no permissions to push into wiki Git. You need add me to collaborators people (only they can edit wiki pages). You can see final result in my repo before that.
For other subscribers, I quote my own investigation outcome from wiki page:
- PATH order matters
- System (Machine) PATH beats User PATH
and that's it 😃 Wrong setup - not a bug.
@kirankotari Hello again! Wiki page is ready, but I have no permissions to push into wiki Git. You need add me to collaborators people (only they can edit wiki pages). You can see final result in my repo before that.
For other subscribers, I quote my own investigation outcome from wiki page:
- PATH order matters
- System (Machine) PATH beats User PATH
and that's it 😃 Wrong setup - not a bug.
@hotenov I liked it, can you please follow the pyenv wiki format. Link, we are trying to keep aligned to it.
@hotenov I liked it, can you please follow the
pyenvwiki format. Link, we are trying to keep aligned to it.
@kirankotari I'll try :)
@kirankotari DONE. I've updated page coping pyenv format.
But I still can't edit (push) into pyenv-win wiki repository. I've accepted your invitation, but have NO* permission. Even on Web UI, Edit button is not available for me. See screenshot.
@hotenov I am not sure why it's doesn't give an option to push the wiki change request. Let me check and get back, in between if you found any links for the setup (repo settings), I can go through them to make it possible.
@hotenov I am not sure why it's doesn't give an option to push the wiki change request. Let me check and get back, in between if you found any links for the setup (repo settings), I can go through them to make it possible.
@kirankotari Unfortunately, quick search didn't give any useful links and I have no such experience too. I see two ways which could help us:
- Try to manage permissions for certain user (me) on repo Settings -> Collaborators -> Manage Access screenshot. Maybe you should look at organization settings as well
- Temporary workaround: You open Wiki editing for all users. Settings -> General -> Features - Wikis - (Uncheck "Restrict editing to collaborates only"). screenshot I quickly push the page and you turn it ON again (if you afraid spam actions from bots / mad people). Very inconvenient way for future Wiki updates (collaborations) but it must work.
UPD: Later search gave me this link:
https://github.community/t/repo-wiki-contributors/633
Where GitHub staff user advice to open Wiki for all too or make docs in the repo (not in Wiki). And link from post with very cumbersome solution by 2016
Curious...is it possible when installing a new version, that the current environment may have a "stale" environment with a previous configuration in memory and the new one not loaded into memory yet?
Maybe pyenv exec or activate a given version?
Curious...is it possible when installing a new version, that the current environment may have a "stale" environment with a previous configuration in memory and the new one not loaded into memory yet?
Maybe pyenv exec or activate a given version?
We don't have activate options, currently we are supporting pyenv local <python-version> and you can using pipenv on top of pyenv
@hotenov Sorry for the delay, I have sent an invite to pyenv org, please accept that might give you access to wiki page updates.
- [ ] Keeping this thread open for wiki pages by @hotenov
@hotenov Sorry for the delay, I have sent an invite to pyenv org, please accept that might give you access to wiki page updates.
- [ ] Keeping this thread open for wiki pages by @hotenov
@kirankotari Yes, indeed. I have pushed my changes to wiki . Take a look :)