pyenv-win

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.

View project on GitHub

Installation

Currently we support following ways, choose any of your comfort:

Hurray! When you are done here are steps to Validate installation

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


PowerShell

The easiest way to install pyenv-win is to run the following installation command in a PowerShell terminal:

Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"

If you are getting any UnauthorizedAccess error as below then start Windows PowerShell with the “Run as administrator” option and run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine, now re-run the above installation command.

& : File C:\Users\kirankotari\install-pyenv-win.ps1 cannot be loaded because running scripts is disabled on this system. For
more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:173
+ ... n.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~ 
 + CategoryInfo          : SecurityError: (:) [], PSSecurityException 
 + FullyQualifiedErrorId : UnauthorizedAccess

For more information on ‘digitally signed’ or ‘Security warning’ you can refer to following issue #332

Installation is complete!

Return to README


Git Commands

The default way to install pyenv-win, it needs git commands you need to install git/git-bash for windows

If you are using PowerShell or Git Bash use $HOME instead of %USERPROFILE%

git clone using command prompt git clone https://github.com/pyenv-win/pyenv-win.git "%USERPROFILE%\.pyenv"

steps to add System Settings

Note: Don’t forget the check above link, it contains final steps to complete.

Installation is complete!

Return to README


Pyenv-win zip

Manual installation steps for pyenv-win

If you are using PowerShell or Git Bash use $HOME instead of %USERPROFILE%

  1. Download pyenv-win.zip

  2. Create a .pyenv directory using command prompt mkdir %USERPROFILE%/.pyenv if not exist

  3. Extract and move files to %USERPROFILE%\.pyenv\

  4. Ensure there is a bin folder under %USERPROFILE%\.pyenv\pyenv-win

steps to add System Settings

Note: Don’t forget the check above link, it contains final steps to complete.

Installation is complete!

Return to README


Python pip

For existing python users

Command prompt

pip install pyenv-win --target %USERPROFILE%\\.pyenv

If you run into an error with the above command use the folllowing instead (#303):

pip install pyenv-win --target %USERPROFILE%\\.pyenv --no-user --upgrade

PowerShell or Git Bash

Use the same command as above, but replace %USERPROFILE% with $HOME.

Final steps

Proceed to adding System Settings.

Installation should then be complete!

Return to README


Chocolatey

This needs choco commands to install, installation link

Chocolatey command choco install pyenv-win

Chocolatey page: pyenv-win

Installation is complete!

Validate Installation

Return to README


Add System Settings

It’s a easy way to use PowerShell here

  1. Adding PYENV, PYENV_HOME and PYENV_ROOT to your Environment Variables

    [System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
    
    [System.Environment]::SetEnvironmentVariable('PYENV_ROOT',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
    
    [System.Environment]::SetEnvironmentVariable('PYENV_HOME',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
    
  2. Now adding the following paths to your USER PATH variable in order to access the pyenv command

    [System.Environment]::SetEnvironmentVariable('path', $env:USERPROFILE + "\.pyenv\pyenv-win\bin;" + $env:USERPROFILE + "\.pyenv\pyenv-win\shims;" + [System.Environment]::GetEnvironmentVariable('path', "User"),"User")
    

If for some reason you cannot execute PowerShell command(likely on an organization managed device), type “environment variables for you account” in Windows search bar and open Environment Variables dialog. You will need create those 3 new variables in System Variables section (bottom half). Let’s assume username is my_pc. |Variable|Value| |—|—| |PYENV|C:\Users\my_pc\.pyenv\pyenv-win
|PYENV_HOME|C:\Users\my_pc\.pyenv\pyenv-win
|PYENV_ROOT|C:\Users\my_pc\.pyenv\pyenv-win\

And add two more lines to user variable Path.

C:\Users\my_pc\.pyenv\pyenv-win\bin
C:\Users\my_pc\.pyenv\pyenv-win\shims

Installation is done. Hurray! Return to README


How to use 32-train

Return to README