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.
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. Make sure you're running pyinstaller
in the virtual environment with all dependencies installed.
You can install with
pip install requests
pip install requests try this command once I also got the same error some days before
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.