几年前,我花了一些时间寻找一种方法zbar
使用 Python 2.7 + Windows x64,我发布了这个工作解决方案:如何在(最好是纯)Python 中解码 QR 码图像? https://stackoverflow.com/questions/27233351/how-to-decode-a-qr-code-image-in-preferably-pure-python/50435929#50435929
现在我注意到pip install zbar
仍然不能在 Python 3.7 中开箱即用,所以我尝试从源代码编译它。这是我所做的:
安装“Microsoft Visual C++ Build Tools 2015”(请参阅here https://stackoverflow.com/questions/59968336/how-is-microsoft-build-tools-2015-different-from-visual-c-build-tools-2015/59969042#59969042)
Get the zbar
来源:https://github.com/NaturalHistoryMuseum/ZBarWin64 https://github.com/NaturalHistoryMuseum/ZBarWin64
msbuild zbar64.sln /p:PlatformToolset=v140
,它工作并生成了一个文件libzbar64-0.dll
成功地
将其复制到/x64/Release/libzbar64-0.dll
-
go to Python/
并运行build.bat
但这里失败了:
zbarmodule.c(132): 错误 C2143: 语法错误: ' 之前缺少 '{''
zbarmodule.c(136): 错误 C2143: 语法错误: ' 之前缺少 '{''
zbarmodule.c(197): 错误 C2065: 'PyInt_Type': 未声明的标识符
我不认为问题来自于zbar
这对每个人来说都编译得很好。难道这个版本的zbar不适合Python 3.x吗?
你有一个可行的解决方案来使用zbar
Python 3.x + Windows x64 上的库?
PS:现在还在维护吗?最新的事件似乎是在2012年Mercurial 仓库 http://zbar.hg.sourceforge.net:8000/hgroot/zbar/zbar,并且无法在这个 Github 仓库 https://github.com/ZBar/ZBar nor this one https://github.com/NaturalHistoryMuseum/ZBarWin64/.
要使 zbar 适用于 Python 3.x,您可以安装pyzbar
pip install pyzbar
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)