npm install 执行的时候报错 gyp ERR! find Python问题

gyp verb find Python - executing “py.exe” to get Python executable path
gyp verb find Python - “py.exe” is not in PATH or produced an error
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 “python3” can be used
gyp ERR! find Python - “python3” is not in PATH or produced an error
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 Python is C:\Python37\python.exe
gyp ERR! find Python - “C:\Python37\python.exe” could not be run
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - “C:\Python27\python.exe” could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python
gyp ERR! find Python - “py.exe” is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=“C:\Path\To\python.exe”
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python “C:\Path\To\python.exe”
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python


以管理员权限打开执行:npm install --global --production windows-build-tools

另外方法:
下载python2.7 安装 :(https://www.python.org/download/releases/2.7/)

安装完成之后:

添加修改环境变量即可

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 当你在使用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 ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值