pyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.
pyenv is a great tool. We have ported it to Windows. We need your thoughts to improve this library and your feedback helps to grow the project.
For existing python users, we support installation via pip.
Contributors and Interested people can join us on @Slack. Your help keeps us motivated!
To keep in sync with pyenv linux/mac, pyenv-win now installs 64bit versions by default. To support compatibility with older versions of pyenv-win, we maintain a 32bit train (branch) as a separate release.
Both releases can install 64bit and 32bit python versions; the difference is in version names, for example:
> pyenv install -l .... 3.8.0-win32 3.8.0 3.8.1rc1-win32 3.8.1rc1 3.8.1-win32 3.8.1 3.8.2-win32 3.8.2 3.9.0-win32 3.9.0 ....
>pyenv install -l .... 3.8.0 3.8.0-amd64 3.8.1rc1 3.8.1rc1-amd64 3.8.1 3.8.1-amd64 3.8.2 3.8.2-amd64 ....
pyenv for python is a great tool but, like rbenv for ruby developers, it doesn't directly support Windows. After a bit of research and feedback from python developers, I discovered they wanted a similar feature for Windows systems.
pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.
commands List all available pyenv commands local Set or show the local application-specific Python version global Set or show the global Python version shell Set or show the shell-specific Python version install Install 1 or more versions of Python uninstall Uninstall 1 or more versions of Python update Update the cached version DB rehash Rehash pyenv shims (run this after switching Python versions) vname Show the current Python version version Show the current Python version and its origin version-name Show the current Python version versions List all Python versions available to pyenv exec Runs an executable by first preparing PATH so that the selected Python which Display the full path to an executable whence List all Python versions that contain the given executable
Get pyenv-win via one of the following methods:
pip install pyenv-win --target $HOME\\.pyenv
pip install pyenv-win --target %USERPROFILE%\.pyenv
%USERPROFILE%if not existing
git clone https://github.com/pyenv-win/pyenv-win.git "$HOME/.pyenv"
git clone https://github.com/pyenv-win/pyenv-win.git "%USERPROFILE%\.pyenv"
choco install pyenv-win(this also installs all environment variables)
NOTE: If you are running Windows 10 1905 or newer, you might need to disable the built-in Python launcher via Start > "Manage App Execution Aliases" and turning off the "App Installer" aliases for Python
If you installed using Chocolatey, you can skip to step 3.
Add PYENV and PYENVHOME to your Environment Variables 1. Using either PowerShell or Windows 8/above Terminal run ``` [System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPROFILE + ".pyenv\pyenv-win\","User") [System.Environment]::SetEnvironmentVariable('PYENVHOME',$env:USERPROFILE + ".pyenv\pyenv-win\","User") ``` Note: PYENV_HOME is to support pipenv
Now add the following paths to your USER PATH variable in order to access the pyenv command. Run the following in PowerShell or Windows 8/above Terminal:
[System.Environment]::SetEnvironmentVariable('path', $env:USERPROFILE + "\.pyenv\pyenv-win\bin;" + $env:USERPROFILE + "\.pyenv\pyenv-win\shims;" + [System.Environment]::GetEnvironmentVariable('path', "User"),"User")
Close and reopen your terminal app and run
pyenv, then continue to Step 4
Now run the
pyenv rehashfrom home directory
pyenvto see list of commands it supports. More info...
Installation is done. Hurray!
git checkout -b 32bit-train origin/32bit-train
pyenv --versionand you should see 2.32.x
pip install pyenv-win==2.32.x --target $HOME\.pyenv
pip install pyenv-win==2.32.x --target %USERPROFILE%\.pyenv
With zip file
.pyenvdirectory if not exist under
Now follow the steps to "finish the installation".
pyenv updatecommand for pyenv-win
pyenv install -l
pyenv install 3.5.2
pyenv install 2.4.3 3.6.8
pyenv global 3.5.2
pyenv local 3.5.2.
pythonis called from within this folder. This is different than a virtual env, which needs to be explicitly activated.
pyenv rehashto update pyenv with new shims for the python and libraries' executables.
pyenv uninstall 3.5.2
easy_install.pthfile located in site-packages. This should make pip recognise pyenv-win as installed.
pip install --upgrade pyenv-win
%USERPROFILE%\.pyenv\pyenv-win(which is your installed path) and run
%USERPROFILE%\.pyenv\pyenv-winand replace the folders
binwith the new ones you just downloaded
Question: Does pyenv for windows support python2?
Question: Does pyenv for windows support python3?
Question: I am getting the issue
batch file cannot be found.while installing python, what should I do?
pyenv rehashcommand before creating the bat file on some devices.
Question: System is stuck while uninstalling a python version
%USERPROFILE%\.pyenv\pyenv-win\versions), and delete the folder of the version you want removed.
Question: I installed pyenv-win using pip. How can I uninstall it?
pip uninstall pyenv-win
Question: pyenv-win is not recognised, but I have set the ENV PATH?
pyenv install 2.7.17will install as 64-bit on x64 and 32-bit on x86. (64-bit can still use
2.7.17-win32to install the 32-bit version)
pyenv global/local/shellalso now recognize your platform and select the appropirate bit version. (64-bit users will need to specify
[version]-win32to use the 32-bit versions now)
--allon x64 computers you can use
--64onlyto install only 32-bit or only 64-bit version s of python. (Does nothing on 32-bit computers, and better filters may be in the works later on)
pyenv global/rehashis called automatically after (un)installing a new Python version. (last version specified, if installing multiple)
pyenv update. Users no longer have to wait for pyenv's source repo to be updated to use a new version of Python when it releases, and can also use the new alpha/beta python releases.
pyenv installnow has a
-c/--clearto empty cached installers in the
pyenv rehashnow acknowledges %PATHEXT% (plus PY and PYW) when creating shims instead of just for exe, bat, cmd and py files so more executables are available from
\Scriptsand libraries installed using pip.
pyenv rehashno longer call
pyenv exec, but instead call python directly to prevent issues with other programs executing the shims.