Compile zbar for Python 3.x

痴心易碎 提交于 2020-02-29 05:38:39

问题


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/ZBarWin64

  • msbuild zbar64.sln /p:PlatformToolset=v140, which worked and produced a file libzbar64-0.dll succesfully

  • copy it to /x64/Release/libzbar64-0.dll

  • go to Python/ and run build.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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!