如何在PATH中查找名为“python2”的Python可执行文件并验证其状态

背景:

mac电脑升级后重新拉取老项目后安装node_module 和启动项目报错

gyp info using node-gyp@3.8.0
gyp info using node@14.18.0 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb download using dist-url https://npm.taobao.org/dist
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2

gyp verb check python checking for Python executable "python" in the PATH

gyp verb `which` failed  python Error: not found: python

gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

解决方案1:使用sass 不使用node-sass

npm uninstall node-sass

 npm i -D sass

npm i

参考npm ERR! gyp verb check python checking for Python executable "python2" in the PATH · Issue #20 · themesberg/volt-react-dashboard · GitHub

解决方案2: 根据提示应该是缺少python环境 安装python环境然后设置应该可行

参考:https://www.cnblogs.com/zheng-yuzhu/p/16633889.html

PS:因为我这个项目要的比较急,然后我使用第二种方式太慢了,而且短时间也报错没安装上,所以 我使用的是第一种方式  

作者:wangshang1320

物联沃分享整理
物联沃-IOTWORD物联网 » 如何在PATH中查找名为“python2”的Python可执行文件并验证其状态

发表回复