[英]Why does my .exe generated by PyInstaller not start?
I generated an executable file with PyInstaller, but when I want to launch the application the console window shows me, that it couldn't find a directory or file.我用 PyInstaller 生成了一个可执行文件,但是当我想启动应用程序时,控制台窗口显示它找不到目录或文件。 I checked the location and the folder "_MEI55762" is indeed not present.我检查了位置,确实不存在文件夹“_MEI55762”。
Did anyone have this issue before?以前有人遇到过这个问题吗?
Below the part of the code, where I think the error should be located.在代码部分下方,我认为应该是错误所在。 I think it has something to do with the imports of the "jsonrpclcient" package.我认为这与“jsonrpclcient”包的导入有关。 I didn´t post the full code with the all the GUI lines, since I think it will not help.我没有发布包含所有 GUI 行的完整代码,因为我认为这无济于事。 If I am wrong please let me know.如果我错了,请告诉我。
import os
import sys
import requests
import json
import pyvisa
import time
from datetime import datetime
import threading
import signal
from jsonrpcclient import *
from jsonrpcclient.clients.http_client import HTTPClient
from jsonrpcclient.requests import Request
from tkinter import *
from tkinter import ttk
import traceback
print("-----------------------------------------")
print(" Q-Center V0.1 ")
print("-----------------------------------------")
port = ":8080"
rm = pyvisa.ResourceManager()
def listArticles():
for attempt in range (3): #Will be executed 3 times in case an error occurs
print('List Articles:')
try: #First try this
client = HTTPClient("http://" + ipEntry.get() + port)
response = client.send(Request("list_articles"), timeout=5)
print(response.data.result)
print('Success!')
except: #If an error occurs, call the print function and let the user know
print('An error occured!')
rebootPeacock()
else: #If no error occurs, stop trying
break
else: #If no attempt was successful, print that all 3 attempts failed. ONLY EXCUTED WHEN THE LOOP DOES'T BREAK.
print('All 3 attempts failed!')
answer = response.data.result
pkReply.insert(END, answer)
pkReply.insert(END, '\n\n')
The solution is to tell PyInstaller to add the "response-schema.json" file which is located at "C:\\Users\\pfra\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\site-packages\\jsonrpcclient".解决方案是告诉 PyInstaller 添加位于“C:\\Users\\pfra\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\site-packages\\jsonrpcclient”的“response-schema.json”文件。
So the command should look like:所以命令应该是这样的:
pyinstaller --add-file "C:\Users\pfra\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\jsonrpcclient.response.schema.json;."
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.