[英]Pyinstaller exe file failed to execute script due to unhandled exception
im trying to turn my python program into an.exe file with the command pysintaller --onefile [name], everything goes perfectly but then when i run my.exe file i get the error " failed to execute script due to unhandled exception, No module name requests. I have already installed the libraries and moved my folder out of the dist file, but same thing. Can anyone help me please?(i tested my code with Visual studio it works.我试图使用命令 pysintaller --onefile [name] 将我的 python 程序转换为 .exe 文件,一切正常,但是当我运行 my.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()
It looks like it can't find the requests
module.看起来它找不到
requests
模块。 Make sure you're running pyinstaller
in the virtual environment with all dependencies installed.确保您在安装了所有依赖项的虚拟环境中运行
pyinstaller
。
You can install with你可以安装
pip install requests
pip install requests try this command once I also got the same error some days before pip 安装请求一旦我几天前也遇到同样的错误,请尝试此命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.