简体   繁体   English

由于未处理的异常,Pyinstaller exe 文件无法执行脚本

[英]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.

相关问题 Pyinstaller“由于未处理的异常而无法执行脚本”错误 - Pyinstaller "Failed to execute script due to unhandled exception" Error Pyinstaller exe执行脚本失败 - Pyinstaller exe failed to execute script pyinstaller python exe 未运行 [脚本中未处理的异常] - pyinstaller python exe not running [unhandled exception in script] Pyinstaller.exe 不工作(脚本中未处理的异常) - Pyinstaller .exe not working (unhandled exception in script) 由于未处理的异常,无法执行脚本“App-Name.py”:[Errno 2] 没有这样的文件或目录 - Failed to execute script 'App-Name.py' due to unhandled exception: [Errno 2] No such file or directory Pyinstaller 不会将 pkg 导入 exe 文件/无法执行脚本 - Pyinstaller wont import a pkg into the exe file / failed to execute the script 尝试运行 pyinstaller 创建的 .exe 文件时“执行脚本失败” - “Failed to execute script” when trying to run .exe file created by pyinstaller 由于未处理的异常而无法执行脚本:选择默认后端“matplotlib”时绘制matplotlib - Failed to execute script due to unhandled exception: matplotlib is required for plotting when the default backend “matplotlib” is selected 由于未处理的异常,没有名为 pyfiglet.fonts 的模块无法执行脚本 - no module named pyfiglet.fonts failed to execute script due to unhandled exception Pyinstaller - “致命错误! 将脚本转换为 exe 时无法执行脚本” - Pyinstaller - “Fatal error ! Failed to execute script” when converting script to exe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM