Python for Windows is really easy to install-but what if you had started in the world of MacOS/*nix OSes and miss that single command to call Python or Pip? What if you don't have access to modify your environment PATH?
Windows PowerShell has a feature called "Profiles" which allows you to configure your PowerShell in a similar fashion as you could with Bash, Zsh, etc.
Pretty cool huh?
To create a Profile (if you don't have one already):
New-Item -Type file -Force $profile
To modify your profile, you need to locate it of course-if you're using Visual Studio Code however you can open the file easily by using this command:
code $profile
Similar to setting Aliases in another shell, like Bash, you will want to configure them in the profile so they persist each time you close and re-open PowerShell. Please note, the paths below for the Python and Pip executables are only relevant to a single-user install of the Python for Windows application. You will have to figure out where these are on your system as it can vary quite a bit depending on which Python distribution (e.g. Anaconda) you are using and how it was "installed".
Set-Alias python "$HOME\AppData\Local\Programs\Python\Python38\python.exe"
Set-Alias pip "$HOME\AppData\Local\Programs\Python\Python38\scripts\pip.exe"
Once you close and re-open your PowerShell window, you're ready to roll, go ahead and type pip
at the prompt and see the output!
Enjoy!
I am just now starting to discover why it's sometimes not a good idea to add certain things to PATH. I'm new to PS, so thank you!