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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file pyenv-win-1.2.4.tar.gz.

File metadata

  • Download URL: pyenv-win-1.2.4.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9

File hashes

Hashes for pyenv-win-1.2.4.tar.gz
Algorithm Hash digest
SHA256 ac2365c8654e6d3ab71ffa210b3e3f3a331ba37d8c765c7edaec4fe2e1683d3e
MD5 4ba0daafaed2d01c8c22a95801b6a79d
BLAKE2b-256 424ca95b13dc2b67d09f3cdf8c8efe3eec05cff77e5bf72ec485514273e55951

See more details on using hashes here.

File details

Details for the file pyenv_win-1.2.4-py3-none-any.whl.

File metadata

  • Download URL: pyenv_win-1.2.4-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.9

File hashes

Hashes for pyenv_win-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c47ab74cc86f4b31d5635b81871bad66348f2dc14d636f4ae9cf9598f8545eb5
MD5 baefcfe0e3d46185a30a98b26adccf91
BLAKE2b-256 17ebd014eb00c361037d9e573a8a4f7126410ce65b2065abbe5d8cb4013a94f8

See more details on using hashes here.

Supported by

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