npm install 报错stack Error: Can't find Python executable "python"

243 阅读1分钟

原因分析:Mac系统升级之后,系统没有内置python2的环境,node低版本的前端项目,在下载依赖的时候node-sass需要python2的环境,造成项目编译失败

解决办法:

cd ~

// 查看是否有单独安装python环境
cat .zprofile(vim .zprofile)   

image.png

这里我已经安装了,如果没有去官网下载python.org python2.7版本

执行 brew 的 search 命令看看有哪些python版本可供安装

brew search python 

安装成功后,查看 zprofile 配置文件 2.7环境是否引入是否成功引入

// 查看是否有单独安装python环境
cat .zprofile(vim .zprofile)   

重新加载配置文件

Source .zprofile 
or
Source ~/.zprofile

列出所有brew安装的软件

Brew list