npm install / yarn 执行的时候报错 gyp ERR! find Python 解决方案

在正常的npm install 的时候报错比较少,正常都是少了一些步骤
比如react 需要项目初始化 npm init 或者是项目上次没保存遗留的代码报错问题,
总结一下,细心一点做事犯错自然就变少了

gyp ERR! find Python 
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking 
  • 18
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 12
    评论
回答: 当你在使用npm时遇到"npm ERR! gyp ERR! find Python"的错误时,这通常是因为你的项目需要使用特定版本的node。你可以通过查看项目中的package.json文件来确定所需的node版本。在package.json文件中,你可以找到"@types/node"的版本号,例如"^14.14.37"。这表示你的项目需要使用14.14.37版本的node。\[1\] 在解决这个问题的过程中,有两种方法可以尝试。旧的解决方法是下载并安装对应版本的Python,例如Python 2.7。你可以从官方网站下载Python 2.7并进行安装。安装完成后,你需要修改环境变量。你可以通过右键点击"此电脑",选择"属性",然后进入"高级系统设置",在"高级"选项卡下找到"环境变量",在上半部分进行修改。这是一个简单的示例,你可以在百度上找到完整的教程来修改环境变量。\[2\] 另一种新的解决方法是使用管理员权限打开命令行,并执行以下命令:npm install --global --production windows-build-tools。这个命令将安装Windows构建工具,它包含了所需的Python版本。这种方法可以更方便地解决问题。\[2\] 综上所述,你可以根据项目中的package.json文件确定所需的node版本,并尝试使用旧的或新的解决方法来解决"npm ERR! gyp ERR! find Python"的错误。 #### 引用[.reference_title] - *1* [项目install的时候报错gyp ERR! find Python](https://blog.csdn.net/Anyuegogogo/article/details/128345133)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [npm install / yarn 执行的时候报错 gyp ERR! find Python 解决方案](https://blog.csdn.net/wangtao88888888/article/details/106681641)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值