yarn 安装报python相关错误

在尝试使用node-gyp时遇到错误,系统中存在Python3.10但需要的是Python3.7。使用brew安装Python3.7失败,提示因上游废弃及架构要求不匹配导致。已尝试从官网下载并配置Python3.7。
摘要由CSDN通过智能技术生成

报错信息,看起来与python相关

gyp info using node-gyp@7.1.2
gyp info using node@16.14.2 | darwin | arm64
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 find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - executable path is "/usr/local/opt/python@3.10/bin/python3.10"
gyp verb find Python - executing "/usr/local/opt/python@3.10/bin/python3.10" to get version
gyp verb find Python - version is "3.10.6"
gyp info find Python using Python version 3.10.6 found at "/usr/local/opt/python@3.10/bin/python3.10"
gyp verb get node dir no --target version specified, falling back to host node version: 16.14.2
gyp verb command install [ '16.14.2' ]
gyp verb download using dist-url https://npm.taobao.org/dist
gyp verb install input version string "16.14.2"
gyp verb install installing version: 16.14.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 16.14.2

gyp info using node-gyp@3.8.0
gyp info using node@16.14.2 | darwin | arm64
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 "python3.7" in the PATH
gyp verb `which` failed Error: not found: python3.7

解决方法

当前python版本:

Python 3.9.6 (default, Oct 18 2022, 12:41:40) 
看起来需要使用python3.7

1.使用brew 安装报错

brew install python@3.7
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Warning: python@3.7 has been deprecated because it is deprecated upstream!
python@3.7: The x86_64 architecture is required for this software.
Error: python@3.7: An unsatisfied requirement failed this build.

2.直接在官网下载安装

https://www.python.org/downloads/macos/

默认安装,配置python3

alias python3=/usr/local/bin/python3.7
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值