李锋镝的博客

  • 首页
  • 时间轴
  • 插件
  • 评论区显眼包🔥
  • 左邻右舍
  • 博友圈
  • 关于我
    • 关于我
    • 另一个网站
    • 我的导航站
    • 网站地图
  • 留言
  • 赞助
Destiny
自是人生长恨水长东
  1. 首页
  2. 代码人生
  3. 正文

hnswlib installation failed

2023年5月26日 105点热度 3人点赞 2条评论

用Python做langflow的时候,遇到一个奇怪的问题:
Mac 英特尔芯片的本子,导入hnswlib依赖的时候报错
环境:python3
错误信息:

Building wheels for collected packages: hnswlib
  Building wheel for hnswlib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for hnswlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      running bdist_wheel
      running build
      running build_ext
      creating var
      creating var/folders
      creating var/folders/cv
      creating var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn
      creating var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/Users/lifengdi/WorkSpaces/PycharmProjects/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpjn2j37vr.cpp -o var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpjn2j37vr.o -std=c++14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/Users/lifengdi/WorkSpaces/PycharmProjects/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c /var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpvj2j9km2.cpp -o var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/tmpvj2j9km2.o -fvisibility=hidden
      building 'hnswlib' extension
      creating build
      creating build/temp.macosx-10.9-universal2-cpython-39
      creating build/temp.macosx-10.9-universal2-cpython-39/python_bindings
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/private/var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/pip-build-env-8f2y000v/overlay/lib/python3.9/site-packages/pybind11/include -I/private/var/folders/cv/dtvck8ws72q79_jsyp4scr9h0000gn/T/pip-build-env-8f2y000v/overlay/lib/python3.9/site-packages/numpy/core/include -I./hnswlib/ -I/Users/lifengdi/WorkSpaces/PycharmProjects/langflow/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/include/python3.9 -c ./python_bindings/bindings.cpp -o build/temp.macosx-10.9-universal2-cpython-39/./python_bindings/bindings.o -O3 -march=native -stdlib=libc++ -mmacosx-version-min=10.7 -DVERSION_INFO=\"0.7.0\" -std=c++14 -fvisibility=hidden
      clang: error: the clang compiler does not support '-march=native'
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hnswlib
Failed to build hnswlib
ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects

解决办法:

export HNSWLIB_NO_NATIVE=1
除非注明,否则均为李锋镝的博客原创文章,转载必须以链接形式标明本文链接

本文链接:https://www.lifengdi.com/dai-ma-ren-sheng/4051

相关文章

  • WordPress网站换了个字体,差点儿把样式换崩了
  • Python 3.12并发革命:大厂争相升级的底层逻辑与实战指南
  • TIOBE 12月榜单:C#有望摘得年度语言,R语言重返Top 10
  • 从零开发 MCP 协议工具:从原理到实战的完整指南(Python 版)
  • 工程师专属 AI 自学路线:从入门到实战,避开90%的坑(2025 最新版)
本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可
标签: Python
最后更新:2025年11月20日

李锋镝

既然选择了远方,便只顾风雨兼程。

打赏 点赞
< 上一篇
下一篇 >

文章评论

  • 王光卫博客黑铁

    排错也是个耐心的工作啊,ChatGPT有时候也能解决简单的问题,复杂了又要烧脑

    macOS
    Chrome 114.0.0.0 中国-四川-成都
    2023年6月6日
    回复
    • 李锋镝大师

      @王光卫博客 确实很烧脑,头发头快秃了

      macOS
      Chrome 112.0.0.0 中国-北京
      2023年6月6日
      回复
  • 1 2 3 4 5 6 7 8 9 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 46 47 48 49 50 51 52 53 54 55 57 58 60 61 62 63 64 65 66 67 69 72 74 76 77 78 79 80 81 82 85 86 87 90 92 93 94 95 96 97 98 99
    取消回复

    位卑未敢忘忧国,事定犹须待阖棺。

    那年今日(12月17日)

    • 1981年:德国足球运动员蒂姆·维泽出生
    • 1971年:印度和东巴基斯坦达成停火协议
    • 1909年:比利时国王利奥波德二世逝世
    • 1905年:狙击之王西蒙·海耶出生
    • 1902年:京师大学堂正式开学
    • 更多历史事件
    最新 热点 随机
    最新 热点 随机
    AI原生数据库新标杆:seekdb深度解析,轻量架构与混合搜索的双重革命 做了一个WordPress文章热力图插件 Spring WebFlux底层原理深度剖析-从响应式流到事件循环的全链路拆解 Spring WebFlux深度解析:异步非阻塞架构与实战落地指南 规范驱动AI编程:用OpenSpec实现100%可控开发,从需求到代码的全流程闭环 WordPress网站换了个字体,差点儿把样式换崩了
    玩博客的人是不是越来越少了?准备入手个亚太的ECS,友友们有什么建议吗?使用WireGuard在Ubuntu 24.04系统搭建VPNWordPress实现用户评论等级排行榜插件Gemini 3 Pro 深度测评:多模态AI编程的跨代际突破,从一句话到完整应用的全链路革命WordPress网站换了个字体,差点儿把样式换崩了
    使用itext和freemarker来根据Html模板生成PDF文件,加水印、印章 项目中不用 redis 分布式锁,怎么防止用户重复提交? SpringBoot框架自动配置之spring.factories和AutoConfiguration.imports JAVA线程池简析(JDK1.6) IDEA版本2020.*全局MAVEN配置 Gemini 3 深度解析:从像素级复刻到 AGI 雏形,多模态 AI 如何重构开发与创作?
    标签聚合
    JVM WordPress SQL 日常 K8s 架构 SpringBoot AI编程 MySQL ElasticSearch 多线程 分布式 数据库 AI JAVA docker 设计模式 Spring IDEA Redis
    友情链接
    • Blogs·CN
    • Honesty
    • 临窗旋墨
    • 哥斯拉
    • 彬红茶日记
    • 志文工作室
    • 搬砖日记
    • 旧时繁华
    • 林羽凡
    • 瓦匠个人小站
    • 皮皮社
    • 知向前端
    • 蜗牛工作室
    • 韩小韩博客
    • 风渡言

    COPYRIGHT © 2025 lifengdi.com. ALL RIGHTS RESERVED.

    Theme Kratos Made By Dylan

    津ICP备2024022503号-3