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

2,531 阅读1分钟

Can't find Python

拿到一个新框架,安装依赖,结果走一半报错了,如图:

上面给了这段提示:Can't find Python executable "python", you can set the PYTHON env variable. 看得我很困惑。

把这句放在网上一搜,就找到了不少方案,这是个我试过可行的办法:

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

我首先在vscode上执行这段脚本,结果还是出问题了,如图:

按照它的提示,我把powershell用管理员权限打开,把这段脚本在上面执行,很顺利地完成了:

接下来,把npm依赖包卸载(npm uninstall)或者直接手动删掉文件夹,再重新执行npm i命令就可以正常使用了。