问题
A few years ago I spent some time finding a way to make zbar
work with Python 2.7 + Windows x64, and I posted this working solution: How to decode a QR-code image in (preferably pure) Python?
Now I notice pip install zbar
still does not work out-of-the-box with Python 3.7, so I'm trying to compile it from source. Here is what I did:
Install "Microsoft Visual C++ Build Tools 2015" (see here)
Get the
zbar
source from: https://github.com/NaturalHistoryMuseum/ZBarWin64msbuild zbar64.sln /p:PlatformToolset=v140
, which worked and produced a filelibzbar64-0.dll
succesfullycopy it to
/x64/Release/libzbar64-0.dll
go to
Python/
and runbuild.bat
but here it failed:zbarmodule.c(132): error C2143: syntax error: missing '{' before ''
zbarmodule.c(136): error C2143: syntax error: missing '{' before ''
zbarmodule.c(197): error C2065: 'PyInt_Type': undeclared identifier
I don't think the problem comes from zbar
which compiles fine for everyone. Could it be that this version of zbar is not ok for Python 3.x?
Do you have a working solution to use the zbar
library on Python 3.x + Windows x64?
PS: is it still maintained? The latest events seem to be in 2012 on the Mercurial repo, and it's not possible to post an issue on this Github repo nor this one.
来源:https://stackoverflow.com/questions/59969573/compile-zbar-for-python-3-x