Skip to content
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.
VBScript Batchfile Python Shell
Branch: master
Clone or download

Latest commit

kirankotari Update README.md
corrected the zip installation path
Latest commit 1072c5c Feb 10, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update feature_request.md Feb 8, 2019
pyenv-win Add recent python3 releases Dec 20, 2019
tests adding setup configuration file Feb 10, 2019
.gitignore upated readme for pip install Feb 11, 2019
.python-version Merge branch 'master' of https://github.com/pyenv-win/pyenv-win Nov 15, 2019
.version version file was missing in pypi Nov 19, 2019
LICENSE added name in license Jan 25, 2019
README.md Update README.md Feb 10, 2020
_config.yml Set theme jekyll-theme-architect Feb 8, 2019
mirrors.txt add mirrors.txt Jul 21, 2019
requirements.txt adding requirement file Mar 8, 2019
setup.py version file was missing in pypi Nov 19, 2019

README.md

pyenv for Windows

pyenv is a great tool. I ported it to Windows. Some commands aren't implemented, but it's good enough for basic use.

For existing python users, we support installation via pip: follow instructions
Contributors and Interested people can join us @ Slack

Link to Official 2019 Python Developers Survey

License: MIT GitHub issues open Downloads

Introduction

pyenv for python is a great tool but, like rbenv for ruby developers, it doesn't support Windows directly. After a bit of research and feedback from python developers, I discovered they wanted a similiar feature for Windows systems.

I got inspired from the pyenv issue for Windows support. Personally, I use Mac and Linux with beautiful pyenv, but some companies still use Windows for development. This library is to help Windows users manage multiple python versions.

I found a similar system for rbenv-win for ruby developers. This project was forked from rbenv-win and modified for pyenv. Some command aren't implemented, but it's good enough for basic use.

pyenv

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-win commands

   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 a Python version using python-build
   uninstall   Uninstall a specific Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   version     Show the current Python version and its origin
   versions    List all Python versions available to pyenv
   exec        Runs an executable by first preparing PATH so that the selected Python

Installation

Get pyenv-win

Get pyenv-win via one of the following methods. (Note: examples are in command prompt. For Powershell, replace %USERPROFILE% with $env:USERPROFILE. For Git Bash, replace with $HOME.)

  • With pip (to support existing python users)
    • pip install pyenv-win --target %USERPROFILE%/.pyenv
  • With zip file
    1. Download link: pyenv-win
    2. Extract to %USERPROFILE%/.pyenv
  • With Git
    • git clone https://github.com/pyenv-win/pyenv-win.git %USERPROFILE%/.pyenv

Finish the installation

  1. Add a new variable under System variables in ENVIRONMENT with name:
    PYENV value: %USERPROFILE%\.pyenv\pyenv-win
  2. Now add the following paths to your ENVIRONMENT PATH variable in order to access the pyenv command (don't forget to separate with semicolons):
    • %PYENV%\bin
    • %PYENV%\shims
    • ENVIRONMENT PATH :: This PC -> Properties -> Advanced system settings -> Advanced -> Environment Variables... -> PATH
    • Be careful! People who uses Windows (>= May 2019 Update) must put these items above %USERPROFILE%\AppData\Local\Microsoft\WindowsApps; See this article.
  3. Verify the installation was successful by opening a new terminal and running pyenv --version
  4. Now run the pyenv rehash from home directory
  5. Run pyenv to see list of commands it supports. More info...

Installation is done. Hurray!

Usage

  • To view a list of python versions supported by pyenv windows: pyenv install -l
  • To install a python version: pyenv install 3.5.2
    • Note: Older versions of python use an MSI file. You'll need to click through the wizard during installation. There's no need to change any options in it.
  • To set a python version as the global version: pyenv global 3.5.2
    • This is the version of python that will be used by default if a local version (see below) isn't set.
    • Note: The version must first be installed
  • To set a python version as the local version: pyenv local 3.5.2.
    • The version given will be used whenever python is called from within this folder. This is different than a virtual env, which needs to be explicitly activated.
    • Note: The version must first be installed
  • After (un)installing any python version, you must run pyenv rehash to update pyenv with the new python version.
    • Note: This must be run outside of the .pyenv folder
  • To uninstall a python version: pyenv uninstall 3.5.2
  • To view which python you are using and its path: pyenv version
  • To view all the python versions installed on this system: pyenv versions

How to get updates

  • If installed via pip
    • Add pyenv-win installed path to easy_install.pth file which is located in site-package. Now pyenv-win is recognised by pip
    • Get updates via pip pip install --upgrade pyenv-win
  • If installed via Git
    • Go to the %USERPROFILE%/.pyenv/pyenv-win (which is your installed path) and run git pull
  • If installed via zip
    • Download the latest zip and extract it
    • Go to %USERPROFILE%/.pyenv/pyenv-win/ and replace the folders libexec and bin with the new ones you just downloaded

FAQ

  • Question: Does pyenv for windows support python2?

    • Answer: Yes, We support python2 from version 2.0.1. We support it from 2.0.1 until python.org officially removes it.
  • Question: Does pyenv for windows support python3?

    • Answer: Yes, we support python3 from version 3.0. We support it from 3.0 until python.org officially removes it.
  • Question: I am getting the issue batch file cannot be found. while installing python, what should I do?

    • Answer: You can ignore it. It's calling pyenv rehash command before creating the bat file in few devices.
  • Question: System is stuck while uninstalling the python version, what to do?

    • Answer: It's based on the system policies in some computers, recommend to uninstall in these computers by going to the path %USERPROFILE%/.pyenv/pyenv-win/install_cache/. I believe you know manual uninstallation. Please remove the site-package and scripts while uninstalling (mandatory). Double check the python version folder doesn't exist in the path %USERPROFILE%/.pyenv/pyenv-win/versions/ if exist please do remove it (mandatory).
  • Question: I installed pyenv-win using pip. How can I uninstall it?

    • Answer: Follow the pip instructions in How to get updates and then run pip uninstall pyenv-win
  • Question: pyenv-win not recognised, but I have set the ENV PATH?

    • Answer: According to windows added the path in User or System variable, For User variale you need to logout and login to reflect the path. For System variavle it's not required.

How to contribute

  • Fork the project & clone locally.
  • Create an upstream remote and sync your local copy before you branch.
  • Branch for each separate piece of work. It's a good practise to write test cases.
  • Do the work, write good commit messages, and read the CONTRIBUTING file if there is one.
  • Test the changes by running tests\test_install.bat and tests\test_uninstall.bat
  • Push to your origin repository.
  • Create a new Pull Request in GitHub.

Bug Tracker and Support

  • Please report any suggestions, bug reports, or annoyances with pyenv-win through the GitHub bug tracker.

License and Copyright

  • pyenv-win is licensed under MIT 2019

    License: MIT

Author and Thanks

pyenv-win was developed by Kiran Kumar Kotari and Contributors

You can’t perform that action at this time.