文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

gyp ERR find Python 解决方案

2023-09-12 11:04

关注

命令行报错如下

E:\vue-admin\node_modules\fibers>if not defined npm_config_node_gyp (node "D:\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node "D:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )gyp ERR! find Pythongyp ERR! find Python Python is not set from command line or npm configurationgyp ERR! find Python Python is not set from environment variable PYTHONgyp ERR! find Python checking if "python" can be usedgyp ERR! find Python - "python" is not in PATH or produced an errorgyp ERR! find Python checking if "python2" can be usedgyp ERR! find Python - "python2" is not in PATH or produced an errorgyp ERR! find Python checking if "python3" can be usedgyp ERR! find Python - "python3" is not in PATH or produced an errorgyp ERR! find Python checking if the py launcher can be used to find Python 2gyp ERR! find Python - "py.exe" is not in PATH or produced an errorgyp ERR! find Python checking if Python is C:\Python27\python.exegyp ERR! find Python - "C:\Python27\python.exe" could not be rungyp ERR! find Python checking if Python is C:\Python37\python.exegyp ERR! find Python - "C:\Python37\python.exe" could not be rungyp ERR! find Pythongyp 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 PYTHONgyp 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#installationgyp ERR! find Python **********************************************************gyp ERR! find Pythongyp ERR! configure errorgyp ERR! stack Error: Could not find any Python installation to usegyp ERR! stack     at PythonFinder.fail (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47)gyp ERR! stack     at PythonFinder.runChecks (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21)gyp ERR! stack     at PythonFinder. (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16)gyp ERR! stack     at PythonFinder.execFileCallback (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16)gyp ERR! stack     at exithandler (child_process.js:315:5)gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:327:5)gyp ERR! stack     at ChildProcess.emit (events.js:314:20)gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)gyp ERR! stack     at onErrorNT (internal/child_process.js:468:16)gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)gyp ERR! System Windows_NT 10.0.18363gyp ERR! command "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"gyp ERR! cwd E:\lx-fr-admin-ui\node_modules\fibersgyp ERR! node -v v14.5.0gyp ERR! node-gyp -v v5.1.0gyp ERR! not oknode-gyp exited with code: 1Please make sure you are using a supported platform and node version. If youwould like to compile fibers on this machine please make sure you have setup yourbuild environment--Windows + OS X instructions here: https://github.com/nodejs/node-gypUbuntu users please run: `sudo apt-get install g++ build-essential`RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`Alpine users please run: `sudo apk add python make g++`'nodejs' 不是内部或外部命令,也不是可运行的程序或批处理文件。npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! fibers@4.0.3 install: `node build.js || nodejs build.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the fibers@4.0.3 install script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR!     D:\nodejs\node_cache\_logs\2020-07-17T00_46_32_338Z-debug.log

解决方案

1.安装node-gyp
npm install -g node-gyp
2.安装python

推荐安装2.7版本(自行选择32位或者64位安装):
https://www.python.org/downlo...


如果官网下载速度很慢,可以使用另一种安装方式

以管理员身份执行

npm install --global --production windows-build-tools

安装完成后会在C:WindowsSystem32里找到一个名为.windows-build-tools的文件夹

 可以直接按照这个目录配置环境,为了方便,我选择将python27重装到D盘,点击python-2.7.15.amd64.msi选择

 移除之后再点击setup程序,这次可以直接安装

 

 

 

安装成功后,在命令行界面输入python测试是否安装成功

 

配置环境变量

环境变量->系统环境变量->Path

 4.npm 配置

npm config set python "D:\Python27\python.exe"npm config set node_gyp "D:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"

配置成功后,再次运行npm install就不会报错了

来源地址:https://blog.csdn.net/m0_59485658/article/details/128265461

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯