Skip to content

Instantly share code, notes, and snippets.

@lonsty
Last active April 11, 2021 09:07
Show Gist options
  • Save lonsty/1c1bcd7fa874ae71b1a4438e128b2899 to your computer and use it in GitHub Desktop.
Save lonsty/1c1bcd7fa874ae71b1a4438e128b2899 to your computer and use it in GitHub Desktop.
Development on PowerShell

Installations on PowerShell

Git

# 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

PyEnv

Get pyenv-win

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"

Finish the installation

  1. 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")
  1. 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")
  1. 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
  1. Now run the pyenv rehash from home directory

  2. Run pyenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment