报错信息,看起来与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
复制