目录

npm-install时-Error-Cant-find-Python-executable-python,-you-can-set-the-PYTHON-env-variable.解决办法

npm install时 Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.解决办法

https://img-home.csdnimg.cn/images/20240711112329.png

错误原因:Node.js 在安装模块的时候报错,缺少python环境。

找不到Python可执行文件“Python”,可以设置Python env变量。

解决办法:

第一种方式:

安装Python及环境变量配置

一定要安装python2.7的版本

环境变量安装可以参考:

如果第一种方式不行可以试试第二种方式。

第二种方式:

运行下面的命令

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

如果输入上述代码报Please restart this script from an administrative PowerShell!错误,则需要在管理员权限下运行

第三种方式:

命令行添加方式,添加python环境到Node中

  • 输入如下命令,在命令窗口中。
npm config set python C:\Python27\python.exe

[2022:checking for Python executable “python2” in the PATH - 北极的大企鹅 - 博客园

## 一、node报错 gyp verb check python checking for Python executable “python2” in the PATH gyp

https://i-blog.csdnimg.cn/blog_migrate/44bf5cfc3542f7e47e5813b7bf946b0b.png “2022:checking for Python executable "python2" in the PATH - 北极的大企鹅 - 博客园”)

参考自: