- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到 FileNotFoundError: Could not find module 'C:\Users\new user.LAPTOP-5GLT5PL6\PycharmProjects\pythonProject\venv\lib\site-packages\pyzbar\libzbar-64.dll'(或它的依赖项之一)。尝试使用带有构造函数语法的完整路径。 但是,正如您在 screenshot 中看到的那样这里 libzbar-64.dll 存储在上面指定的位置。代码如下,应该是使用tkinter的二维码应用
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from PIL import Image, ImageTk
from pyzbar.pyzbar import decode
import pyqrcode
import os
root = Tk()
root.title("QR code application")
note = ttk.Notebook(root)
note.pack()
# create frames to add on tabs
frame1 = Frame(note, height=400, width=150, bg='white')
frame1.pack(fill="both", expand=True)
frame2 = Frame(note, height=400, width=150, bg='white')
frame2.pack(fill="both", expand=True)
s = ttk.Style()
s.theme_create("style", parent="alt", settings={
"TNotebook.Tab": {"configure": {"padding": [20, 10],
"font": ('Times', '20', 'bold')}}})
s.theme_use("style")
# add tabs
note.add(frame1, text="Generate QR Code")
note.add(frame2, text="Read QR Code")
# create canvas to display image
canvas1 = Canvas(frame1, width="400", height="300", relief=RIDGE, bd=2)
canvas1.pack(padx=10, pady=10)
canvas2 = Canvas(frame2, width="400", height="400", relief=RIDGE, bd=2)
canvas2.pack(padx=10, pady=10)
def generate():
if data_entry.get() != '' and save_entry.get() != '':
qr = pyqrcode.create(data_entry.get())
img = qr.png(save_entry.get() + ".png", scale=5)
info = Label(frame1, text="Generated QR code:", font=('ariel 15 bold'))
info.place(x=60, y=40)
img = Image.open(save_entry.get() + ".png")
img = ImageTk.PhotoImage(img)
canvas1.create_image(200, 180, image=img)
canvas1.image = img
else:
info = Label(frame1, text="Please enter the data for QR code", font=('ariel 15 bold'))
info.place(x=80, y=140)
def selected():
img_path = filedialog.askopenfilename(initialdir=os.getcwd(),
title="Select Image", filetype=(
("PNG file", "*.png"), ("All files", "*.*")))
img = Image.open(img_path)
img = ImageTk.PhotoImage(img)
canvas2.create_image(200, 190, image=img)
canvas2.image = img
d = decode(Image.open(img_path))
data = d[0].data.decode()
qrcode_data = Label(frame2, text=data, bg='gold', fg='black', font=('ariel 15 bold'), relief=GROOVE)
qrcode_data.place(x=150, y=380)
data_label = Label(frame1, text='Enter data:', font=('ariel 15 bold'), bg='white')
data_label.place(x=61, y=330)
save_label = Label(frame1, text='Enter name \n to save with:', font=('ariel 15 bold'), bg='white')
save_label.place(x=55, y=360)
data_entry = Entry(frame1, font=('ariel 15 bold'), relief=GROOVE, bd=3)
data_entry.place(x=197, y=330)
save_entry = Entry(frame1, font=('ariel 15 bold'), relief=GROOVE, bd=3)
save_entry.place(x=197, y=380)
btn1 = Button(frame1, text="Generate", bg='black', fg='gold', font=('ariel 15 bold'), relief=GROOVE, command=generate)
btn1.place(x=85, y=425)
btn2 = Button(frame1, text="Exit", width=10, bg='black', fg='gold', font=('ariel 15 bold'), relief=GROOVE,
command=root.destroy)
btn2.place(x=255, y=425)
btn2 = Button(frame2, text="Select Image", bg='black', fg='gold', font=('ariel 15 bold'), relief=GROOVE,
command=selected)
btn2.pack(side=LEFT, padx=50, pady=5)
btn3 = Button(frame2, text="Exit", width=12, bg='black', fg='gold', font=('ariel 15 bold'), relief=GROOVE,
command=root.destroy)
btn3.pack(side=LEFT, padx=10, pady=5)
root.mainloop()
最佳答案
同样的错误。在 Pypi 页面上阅读,他们说如果 Windows 上出现 ImportError,我们应该安装“Visual C++ Redistributable Package per Visual Studio 2013”
我做了并且工作了!
https://pypi.org/project/pyzbar/ ,请参阅“Windows 导入错误”。
关于python - 找不到文件错误 : Could not find module 'C:\Users\PycharmProjects\(path...)\site-packages\pyzbar\libzbar-64.dll' (or one of its dependencies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68768606/
我正在尝试使用 JAXB 从 XSD 生成 java 类。 XSD 是我公司的官方 xsd,因此我无法仅为我的项目修改它们。在该网站上进行了数百次尝试和搜索后,我决定直接提出问题。 我的 XSD 中有
我已经了解了以下链接中的详细信息,但仍然存在何时使用哪个文件的问题?https://docs.npmjs.com/files/package-lock.json 最佳答案 包.json 包含项目的相关
当我在 centos 上运行命令 rpmbuild -bb mypackage.spec 时,出现错误 error: Package already exists: %package debuginf
my.packages 是 src 目录中的自定义原型(prototype)包。 Plone 实例中的数千个项目与其类型一起添加。我想将包重命名为 my.package。通过简单地卸载 my.pack
根据 javadoc 规范,我在相关包的根目录中放置了一个名为 package-info.html 的文档文件。但是,当我在该文件夹上运行 Doxygen 时,不会拾取该文件中的文档。我如何告诉 Do
我已经定义了如下的包: (defpackage :thehilariouspackageofamirteymuri (:nicknames ampack amir teymuri) (:use
我正在思考这个问题: > .packages() > (.packages()) [1] "stats" "graphics" "grDevices" "utils" "datase
我在内存中有一个 System.IO.Packaging.Package(它是一个 WordprocessingDocument)并且想将它流式传输到浏览器以保存它。 Word 文档已被基于 MVC
即使这是我不常发现的东西,在成员之前注释/* package*/的原因是什么? /* package */ final void attach(Context context) { atta
我正在开发我的应用程序,但在添加包以便导入它时,我总是收到此错误。 error: type 'Package.Dependency' has no member 'Package' 这是我的 Pack
install.packages("data.table") trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.
放置手动创建的插件的最佳位置是什么: a) C:\Users\{UserName}\AppData\Roaming\Sublime Text 3\Packages 或 b) C:\Users\{Use
这是一个有趣的 Perl 行为。 (至少对我来说 :) ) 我有两个包 PACKAGE1 和 PACKAGE2,它们导出具有相同名称的函数 Method1()。 由于将有如此多的包将导出相同的功能,使
package-archives (("marmalade" . "http://marmalade-repo.org/packages/") ("gnu" . "http://elpa.gnu.or
任何人都可以让我知道 package-lock.json 文件的确切用途吗? 尽管许多人提到它用于查看版本化依赖树。 寻找简单易行的解释。 提前致谢。 最佳答案 npm install使用此文件来确保
Python documentation说 Consider this code: import sound.effects.echo import sound.effects.surround fr
我在 ubuntu 上运行 VPS: Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 C
我有这样一个结构 $ tree -h . ├── [1.0K] myproj │ ├── [ 0] index.py │ ├── [ 0] __init__.py │ └──
我正在尝试解压 System.IO.Packaging.Package我从网络服务器收到的。也就是说,我正在使用 System.IO.Packaging.Package.Open(Stream)方法并
关于 package.json 文件中的@types 依赖项,我有一个愚蠢的问题: 在下面的 URL 中解释了应该安装的类型作为运行时依赖 npm install --save @types/loda
我是一名优秀的程序员,十分优秀!