问题
I'm trying to run the following command: npm install -g bower gulp cordova ionic tsd@next karma-cli protractor node-gyp coffee-script js-beautify typescript npm-check
I have installed Python, Visual Studio Express and node-gyp so thought I'd be good to go, however I get the following errors:
Regarding the "Can't find Python executable "python", you can set the PYTHON env variable."
error, I'm a little confused because I have set the PYTHON environmental variable like so:
Any ideas please?
回答1:
You got to add python to your PATH variable. One thing you can do is Edit your Path variable now and add
;%PYTHON%;
Your variable PYTHON should point to the root directory of your python installation.
回答2:
Try:
Install all the required tools and configurations using Microsoft's windows-build-tools by running npm install -g windows-build-tools
from an elevated PowerShell (run as Administrator).
https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#environment-setup-and-configuration
回答3:
https://github.com/nodejs/node-gyp#on-windows
https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#environment-setup-and-configuration
try
npm config set python D:\Library\Python\Python27\python.exe
回答4:
I installed python2.7 to solve this issue. I wish can help you.
回答5:
You are running the Command Prompt as an admin. You have only defined PYTHON for your user. You need to define it in the bottom "System variables" section.
Also, you should only point the variable to the folder, not directly to the executable.
回答6:
The easiest way is to let NPM do everything for you,
npm --add-python-to-path='true' --debug install --global windows-build-tools
回答7:
Just run below command with admin access
npm install --global --production windows-build-tools
回答8:
One of the following solutions will work for you:
- npm config set python
c:\Python\27\python.exe
orset PYTHON=D:\Python\bin\Python.exe
npm config set python D:\Library\Python\Python27\python.exe
- Let npm configure everything for you (takes forever to complete)
npm --add-python-to-path='true' --debug install --global windows-build-tools
(Must be executed via "Run As Administrator" PowerShell)
If not... Try to install the required package on your own (I did so, and it was node-sass
, after installing it manually, the whole npm install
was successfully completed
来源:https://stackoverflow.com/questions/34372618/npm-cant-find-python-executable-python-you-can-set-the-python-env-variabl