Skip to main content

pyenv 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.

Project description

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

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/pyenv-win
  • With Git
    • git clone https://github.com/pyenv-win/pyenv-win.git %USERPROFILE%/.pyenv

Finish the installation

  1. Add a new variable 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyenv-win-1.2.4.tar.gz (22.9 kB view hashes)

Uploaded Source

Built Distribution

pyenv_win-1.2.4-py3-none-any.whl (25.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page