6

I installed Python using Chocolatey:

choco install python3

I did this in an administrative PowerShell prompt. The results seem successful enough:

PS C:\Windows\system32> choco install python3 --force
Installing the following packages:
python3
By installing you accept licenses for the packages.

python3 v3.6.0 (forced)
The package python3 wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider setting
 'allowGlobalConfirmation'. Run 'choco feature -h' for more details.
Do you want to run the script?
 1) yes
 2) no
 3) print
yes
 Downloading python3 64 bit
   from 'https://www.python.org/ftp/python/3.6.0/python-3.6.0-amd64.exe'
 Hashes match.
 Installing python3...
 python3 has been installed.
 Installed to 'C:\Python36'
 The install of python3 was successful.

Chocolatey installed 1/1 package(s). 0 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

However, I don't seem to have Python:

PS C:\Windows\system32> python
The term 'python' is not recognized as the name of a cmdlet,

So...maybe it's installed, but not in my PATH? Is there some way for me to know where it installed to?

1
  • 1
    You need to add C:\Python36;C:\Python36\bin to your PATH, and then restart the terminal or use refreshenv – Burhan Khalid Dec 25 '16 at 6:59
7

In Windows you can't normally just install something and immediately use it on the command line without closing and reopening your command shell.

Chocolatey however comes with a command you can run called "refresh environment", or refreshenv for short. Typically if the PATH gets updated, Chocolatey reminds you to run refreshenv to update your shell.

This allows you to immediately take advantage of newly installed apps.

Here's an annotated example of this:

Shows Upgrades / PATH changes / refreshenv

4
  • 1
    Thanks, didn't know about refreshenv! – Jay Sullivan Dec 28 '16 at 4:48
  • When I tried it, refreshenv didn't work for me on Windows 10, installing Python - 'python' could not be found. 'python' started when invoked in a newly opened PowerShell window. – Peter Mortensen Aug 23 '18 at 16:23
  • 1
    @PeterMortensen - by default refreshenv won't work in PowerShell, you must have the PowerShell profile for Chocolatey set up. See chocolatey.org/docs/troubleshooting#refreshenv-has-no-effect – ferventcoder Aug 27 '18 at 23:30
  • Back in 2021, there seems to be problems installing Python3.9 in choco. It wont, but creates a link to the MS Store when python from PS. In C:\ProgramData\chocolatey\lib there is python that contains nupkg and nuspec but not more after choco install python. I get also errors: - python3 (exited 1603) - Error while running 'C:\ProgramData\chocolatey\lib\python3\tools\chocolateyInstall.ps1'. Any help? – Timo Jan 3 at 13:49
2

It's installed here as you can see from the installation log:

'C:\Python36'
1
  • Thanks, I failed to read the output due to a combination of frustration, disillusionment and pessimism. – Jay Sullivan Dec 28 '16 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.