A green tree python.

Chocolatey installs Python where on Windows?

Where does Chocolatey install python?

It’s useful to know where chocolatey installs python. A lot of tools use Python. For me that includes Vim, Sphinx, and gulp-imagemin. Those programs read environmental variables such as PATH and PYTHON to know where to find the executable and its scripts. That means we need to know where chocolatey installs Python.

I like to install programs using chocolatey, which is the package manager for Windows, because it’s quick and easy from the command line or PowerShell, but the challenge with chocolatey is learning where it installs programs. Where does it put the python.exe file? Here is a way to investigate that with PowerShell’s Get-ChildItem commandlet.

Once we know the Python install location, we can update our environmental variables, and happiness ensues.

Investigate the Install with PowerShell

First we’ll want to extirpate Python from our computer, because we want to see only where chocolatey installs it, not where it was already installed by some other means. We don’t always need to do this, but today I’d like to be thorough.

So, uninstall Python with chocolatey (choco uninstall python). Also uninstall it with Windows > Control Panel > Programs & Features (to do this, we sometimes have to repair Python first. Use Revo Uninstall if you must.) Once it is all uninstalled, check if it remains installed anywhere. Note: you also might want to remove python from your PATH and PYTHON environmental variables.

Below we are uninstalling with chocolatey and then checking whether any python.exe (or python3.exe) files remain on the system at a depth of 10. We do this using the neat Get-ChildItem command and itsĀ  -recurse, -depth andĀ  -filter options. We’ll do a pre- and post- investigation. This is the pre-investigation. Right after we have extirpated python from our computer, the output shows no python executables.

PS> choco uninstall python
PS> Get-ChildItem -Recurse -Depth 10 -Filter *python*.exe -ErrorAction SilentlyContinue | select fullname


Next, install Python with chocolatey. Then use Get-ChildItem again to check where chocolatey installed Python.

PS> choco install -y python --version 2.7.11
PS> Get-ChildItem -recurse -depth 10 -filter *python*.exe -ErrorAction SilentlyContinue | select fullname


Also check for the pip.exe, because this will tell us the location of the Python scripts directory.

PS> Get-ChildItem -recurse -depth 10 -filter *pip.exe -ErrorAction SilentlyContinue | select fullname


Result: for Python 2.7.11, chocolatey installs Python to following locations.

  • C:\tools\python\python.exe
  • C:\tools\python\Scripts

This might be different for installation of Python 3.5.1. Now you know how to find out where it is, though! Use PowerShell’s `Get-ChildItem` commandlet. It’s a really helpful complement to chocolatey.

Get-ChildItem -recurse -depth 10 -filter *python*.exe -ErrorAction SilentlyContinue | select fullname