如何修复 python `dlib` 错误:“在平面命名空间‘_png_do_expand_palette_rgb8_neon’中找不到符号”?
我收到错误:在平面命名空间“_png_do_expand_palette_rgb8_neon”中找不到符号
尽管已为相关 Python 版本安装了 dlib 包,但仍会发生错误。
我正在使用 VSCode,以防相关。
I am getting the error: symbol not found in flat namespace '_png_do_expand_palette_rgb8_neon'
The error occurs in spite of the dlib
package being installed for the relevant Python version.
I am using VSCode, in case that is relevant.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终不得不从源代码安装 dlib:
这是基于 dlib 上的此问题建议安装 libpng 和 此问题homebrew 建议添加
--compiler-flags
。安装 libpng 并设置编译器标志并没有使错误消失,绝望中我进入 dlib/image_save/save_png.h 注释掉断言。然而,代码中有一个有用的推荐:
鉴于我有 libpng,我设置了 DLIB_PNG_SUPPORT 并且构建成功。
然后确保您的虚拟环境处于活动状态(如果适用)并安装它:
I ended up having to install dlib from source:
This was based on this issue on dlib which recommends installing libpng and this issue on homebrew which recommends adding the
--compiler-flags
.Installing libpng and setting the compiler flags didn't make the error go away, and in desperation I went into
dlib/image_save/save_png.h
to comment out the assert. However, there was a helpful commend in the code:Given that I have libpng, I set DLIB_PNG_SUPPORT and building succeeded.
Then ensure your virtual environment is active (if applicable) and install it:
如果您使用以下命令强制重新安装,应该可以工作:
pip3 install dlib --force-reinstall --no-cache-dir --global-option=build_ext
这为我修复了它。
Should work if you force a reinstall using:
pip3 install dlib --force-reinstall --no-cache-dir --global-option=build_ext
That fixed it for me.
对我来说,这是 mac M1 特定问题,通过链接 libpng 解决:(
用您安装的 libpng 版本替换 1.6.37)
For me, this is a mac M1 specific issue, solved by linking libpng:
(replace 1.6.37 by your installed version of libpng)