添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

项目场景: gyp verb check python checking for Python executable “python2” in the PATH

环境

​ node v16.15.0

​ npm 8.5.5

npm install 报错

问题描述

gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\demandindex\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\demandindex\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\demandindex\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\demandindex\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\demandindex\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\demandindex\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at D:\demandindex\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Program Files\python\python.EXE
npm ERR! gyp verb check python version `C:\Program Files\python\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.8.6\r\n"

最开始以为是缺少python2.7

安装了 python2.7 和 windows-build-tools以后依然报错

原因分析:

node-sass和 node版本不对应

我之前的node-sass版本是4.7.2

NodeJS Supported node-sass version Node Module
Node 17 7.0+ 102
Node 16 6.0+ 93
Node 15 5.0+, <7.0 88
Node 14 4.14+ 83
Node 13 4.13+, <5.0 79
Node 12 4.12+, <8.0 72
Node 11 4.10+, <5.0 67
Node 10 4.9+, <6.0 64
Node 8 4.5.3+, <5.0 57
Node <8 <5.0 <57

解决方案:

node-sass 版本修改6.0.1

在执行 npm install

解决

成功解决matplotlib.units.ConversionError: Failed to convert value(s) to axis units: ‘LiR‘ 2022年3月7日 Python图像平滑滤波处理(均值滤波、方框滤波、高斯滤波、中值滤波、双边滤波) 2023年3月29日 刚刚,arXiv论文数破200万,没有arXiv,就没有21世纪的科研突破 2022年1月23日 PyCharm搜索技巧快捷键 2023年3月8日 python手写聚类算法:Kmeans&DBscan算法 2022年2月28日 【Pytorch神经网络实战案例】40 TextCNN模型分析IMDB数据集评论的积极与消极 2022年4月20日 python pandas 数据处理:删除特定行、列 2023年3月11日 计算模型的GFLOPs和参数量 & 举例VGG16和DETR 2023年2月25日 Django web开发(一) – 前端 2023年3月5日 机器学习识别手写数字 – 谁是好人,谁是坏人?【1】 2022年3月7日 Python机器学习:drop()删除行列 2023年4月5日