# Prerequisites: run as Administrator
Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force
# Install for current user
Install-Module posh-git -Scope CurrentUser -Force
# Install for all users, run as Administrator
Install-Module posh-git -Scope AllUsers -Force
Powershell or Git Bash:
git clone https://github.com/pyenv-win/pyenv-win.git "$HOME/.pyenv"
cmd.exe:
git clone https://github.com/pyenv-win/pyenv-win.git "%USERPROFILE%\.pyenv"
- Add PYENV and PYENV_HOME to your Environment Variables
[System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
[System.Environment]::SetEnvironmentVariable('PYENV_HOME',$env:USERPROFILE + "\.pyenv\pyenv-win\","User")
- 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 --version
- If the return value is the installed version of pyenv, then continue to Step 4
- If you receive a "command not found" error, ensure all environment variables are properly set via the GUI: This PC → Properties → Advanced system settings → Advanced → Environment Variables... → PATH
- If you receive a "command not found" error and you are using Visual Studio Code or another IDE with a built in terminal, restart it and try again
-
Now run the pyenv rehash from home directory
-
Run
pyenv