在使用npm安装软件的时候,报以下错误:
npm ERR! gyp verb could not find "c:\Python27\python.exe". checking python launcher
npm ERR! gyp verb could not find "c:\Python27\python.exe". guessing location
npm ERR! gyp verb ensuring that file exists: C:\Python27\python.exe
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "c:\Python27\python.exe", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack at PythonFinder.failNoPython (D:\study\x-touch\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (D:\study\x-touch\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\study\\x-touch\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\study\x-touch\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! Build failed with error code: 1
Can't find Python executable "c:\Python27\python.exe",
主要错误时没有 python环境。
这个时候我们需要安装 Python27
我们就以安装 python 2.7 为例:
1.下载
下载需要的版本 : Python2.7下载
2.安装
安装刚才已经下载下来的安装包, 安装过程下图所示,一路默认操作
一直下一步
3.配置
右击桌面上的“此电脑”—>“属性”—>“高级系统设置”—>右下角“环境变量”—>双击“系统变量”里的“Path”—>点击“新建”—>输入刚才的安装位置“C:\Python27;”,得到新建后的结果,然后一步步确定回去。
查看安装的版本