When I type python in PowerShell I get an error like:
Program 'python' failed to execute: The system cannot find the file specified
At line:1 char:11
+ python.exe <<<< .
At line:1 char:1
+ <<<< python.exe
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
I have added C:\Python27 and its sub directories to PATH. I can run it by typing python.exe. Can run scripts the same way.
I installed Python 2.7.11 64 bit.
The only way I can reproduce your error is if I replace my python.exe file with a new empty text file named python.exe.
I notice you mentioned that you added C:\Python27 and all subdirectories to your PATH. I would first suggest to remove all the subdirectories (just leaving the parent directory) from your path. Make sure you restart Powershell after making this change to pull in the new values. Then test it to see whether this has resolved the issue.
The other possibility is that somewhere on your path you have either a corrupted python.exe or some other cmdlet, function or script file that is shadowing your python installation. You could try running from within powershell:
Get-Command python | Select-Object -ExpandProperty Definition
to see what powershell is actually referencing.* If the only value returned is C:\Python27\python.exe then I would probably suggest a reinstall.
[*] - Taken from https://stackoverflow.com/a/16949127/1468125
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With