Search code examples
pythondllbarcodezbarfilenotfounderror

Python 3.10 cannot import pyzbar


i am using pyzbar 0.1.9 for a barcode reader but when i try to import pyzbar.pyzbar i get this error:

FileNotFoundError: Could not find module 'C:\Users\galax\AppData\Local\Programs\Python\Python310\lib\site-packages\pyzbar\libzbar-64.dll' (or one of its dependencies). Try using the full path with constructor syntax.

i am using python version 3.10.6, is there any way to solve this problem?

this is how im trying to import pyzbar:

    from pyzbar.pyzbar import decode # <-- error in this line

Is there something I'm missing? or is the package corrupted?

i tried uninstalling and installing but it didnt work tho...

any help would be appreciated 🙂


Solution

  • Taken from the pyzbar README:

    If you see an ugly ImportError when importing pyzbar on Windows you will most likely need the Visual C++ Redistributable Packages for Visual Studio 2013. Install vcredist_x64.exe if using 64-bit Python, vcredist_x86.exe if using 32-bit Python.

    So, you need to:

    • Uninstall pyzbar
    • install those Visual C++ redistributables to make pyzbar work on Windows. (vcredist_x64.exe for 64-bit Python)
    • Reinstall pyzbar

    For more info, see also the discussion on pyzbar Issue 93