{"action":"closed","issue":{"url":"https://api.github.com/repos/nodejs/node-gyp/issues/890","repository_url":"https://api.github.com/repos/nodejs/node-gyp","labels_url":"https://api.github.com/repos/nodejs/node-gyp/issues/890/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node-gyp/issues/890/comments","events_url":"https://api.github.com/repos/nodejs/node-gyp/issues/890/events","html_url":"https://github.com/nodejs/node-gyp/issues/890","id":138934302,"number":890,"title":"Provide fallback to Python launcher on Windows when python.exe cannot be found","user":{"login":"poke","id":132240,"avatar_url":"https://avatars.githubusercontent.com/u/132240?v=3","gravatar_id":"","url":"https://api.github.com/users/poke","html_url":"https://github.com/poke","followers_url":"https://api.github.com/users/poke/followers","following_url":"https://api.github.com/users/poke/following{/other_user}","gists_url":"https://api.github.com/users/poke/gists{/gist_id}","starred_url":"https://api.github.com/users/poke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/poke/subscriptions","organizations_url":"https://api.github.com/users/poke/orgs","repos_url":"https://api.github.com/users/poke/repos","events_url":"https://api.github.com/users/poke/events{/privacy}","received_events_url":"https://api.github.com/users/poke/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-07T09:45:42Z","updated_at":"2016-03-31T12:32:58Z","closed_at":"2016-03-31T12:32:58Z","body":"I regularly get the following error:\r\n\r\n    Error: Can't find Python executable \"python\", you can set the PYTHON env variable.\r\n\r\nThis is because Python on Windows **by default** does not place a Python executable into the PATH (and for what it’s worth, I would personally also opt out of that). Instead, Python has this great thing on Windows called the *Python launcher*. It’s an executable that is placed into the WINDIR directory that allows to run *any* installed Python version on the computer. Even more importantly, the installation of this Python launcher is the default and has been for a number of CPython releases. So for Windows, it’s a much better idea to depend on the Python launcher than on a `python` executable.\r\n\r\nSo I’d like to ask for a fallback in node-gyp that attempts to call `py.exe -2` before ultimately failing with the above error message. So the logic would be something like this:\r\n\r\n1. Check for PYTHON environment variable; if set, use that executable\r\n2. Otherwise attempt to call the `python` executable\r\n3. Otherwise, if on Windows, attempt to call the `py -2` executable\r\n4. Otherwise show the error, and ask the user to set the PYTHON environment variable\r\n\r\nNote that the `py.exe` launcher should be called with a `-2` as its first argument. This ensures that a Python 2 executable is used, regardless of what has been set as the system default. Since node-gyp does not appear to support Python 3 at all yet, this would be the safest solution.\r\n\r\nBtw. I also attempted to set the PYTHON environment variable to `py -2` to make it use the Python launcher, but that didn’t work: It sadly couldn’t find the `py -2` executable (i.e. it didn’t interpret the argument properly). Just using `py` did work, but called the wrong Python version on my system."}}