[英]Why does my .exe generated by PyInstaller not start?
我用 PyInstaller 生成了一個可執行文件,但是當我想啟動應用程序時,控制台窗口顯示它找不到目錄或文件。 我檢查了位置,確實不存在文件夾“_MEI55762”。
以前有人遇到過這個問題嗎?
在代碼部分下方,我認為應該是錯誤所在。 我認為這與“jsonrpclcient”包的導入有關。 我沒有發布包含所有 GUI 行的完整代碼,因為我認為這無濟於事。 如果我錯了,請告訴我。
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')
解決方案是告訴 PyInstaller 添加位於“C:\\Users\\pfra\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\site-packages\\jsonrpcclient”的“response-schema.json”文件。
所以命令應該是這樣的:
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.