【发布时间】:2023-01-21 11:16:37
【问题描述】:
我正在尝试使用命令 pysintaller --onefile [name] 将我的 python 程序转换为 .exe 文件,一切都很顺利,但是当我运行我的 .exe 文件时,我收到错误消息“由于未处理的异常而无法执行脚本,否模块名称请求。我已经安装了库并将我的文件夹从 dist 文件中移出,但同样的事情。有人能帮我吗?(我用 Visual Studio 测试了我的代码它有效。
import requests
import tkinter
from cProfile import label
from tkinter import *
from bs4 import BeautifulSoup
def show_data():
link = ent.get()
result = requests.get(link)
soup = BeautifulSoup(result.text, 'html.parser')
images = soup.find_all('img')
liste = []
for image in images:
image = image['src']
if "https://cdn2.sorsware.com" and "buyuk" in image:
liste.append(image)
txt.insert(0.0,liste)
def delete_data():
txt.delete(1.0,END)
gui = Tk()
gui.geometry("1000x500")
gui.title("BSL")
l1 = Label(gui,text="Link:")
ent = Entry(gui,width=600)
l1.grid(row=0)
ent.grid(row=0,column=1)
txt = Text(gui,width=125,wrap=WORD,font=("Arial",10))
txt.place(x=500,y=250,anchor=CENTER)
btn = Button(gui,text = "Results",bg ="black",fg="white",width=5,height=2,command=show_data)
btn.grid(row=1)
btn_delete = Button(gui,text = "delete",bg ="black",fg="white",width=5,height=2,command=delete_data)
btn_delete.grid(row=2)
gui.mainloop()
【问题讨论】:
-
如果没有更多信息,将很难提供帮助。您可以发布使用的
pyinstaller命令以及alp.py和alp.spec的内容吗? -
我刚刚做了,谢谢你让我知道
标签: python tkinter pyinstaller