问题:

这个问题我遇到第二次了,因此整理记录下来。

npm install时报错:

Error: Can't find Python executable "python", you can set the PYTHON env variable

【Bug解决】Error: Can‘t find Python executable “python“, you can set the PYTHON env variable_python

解决方法:

输入命令

npm install --global --production windows-build-tools

然后你可以看到控制台是这样的
【Bug解决】Error: Can‘t find Python executable “python“, you can set the PYTHON env variable_微信公众号_02

再以管理员方式打开PowerShell输入命令

npm install --global --production windows-build-tools

【Bug解决】Error: Can‘t find Python executable “python“, you can set the PYTHON env variable_解决方法_03
之后回到命令窗口,按ctrl+C终止 再输入npm run serve 运行项目
即可运行成功!

【Bug解决】Error: Can‘t find Python executable “python“, you can set the PYTHON env variable_npm_04
成功解决!

【Bug解决】Error: Can‘t find Python executable “python“, you can set the PYTHON env variable_python_05