Python 3.10 无法导入 pyzbar

huangapple go评论86阅读模式
英文:

Python 3.10 cannot import pyzbar

问题

我正在使用 pyzbar 0.1.9 进行条形码阅读器,但当我尝试导入 pyzbar.pyzbar 时,我收到了以下错误:

FileNotFoundError: 找不到模块 'C:\Users\galax\AppData\Local\Programs\Python\Python310\lib\site-packages\pyzbar\libzbar-64.dll'(或其依赖项之一)。尝试使用构造函数语法提供完整路径。

我正在使用 Python 版本 3.10.6,有没有办法解决这个问题?

这是我尝试导入 pyzbar 的方式:

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

我是不是漏掉了什么?还是包损坏了?我尝试过卸载和重新安装,但没有用... 任何帮助将不胜感激 🙏

英文:

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 🙂

答案1

得分: 1

摘自 pyzbar README

如果在 Windows 上导入 pyzbar 时出现 ImportError 错误,您很可能需要安装 Visual C++ Redistributable Packages for Visual Studio 2013。如果使用 64 位 Python,请安装 vcredist_x64.exe,如果使用 32 位 Python,请安装 vcredist_x86.exe。

因此,您需要:

  • 卸载 pyzbar
  • 安装这些 Visual C++ redistributables 以使 pyzbar 在 Windows 上正常工作(64 位 Python 使用 vcredist_x64.exe)
  • 重新安装 pyzbar

更多信息,请参阅 pyzbar Issue 93 上的讨论。

英文:

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

huangapple
  • 本文由 发表于 2023年7月28日 01:10:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76782053.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定