Error compiling with pyinstaller, “Error loading python38.dll”

China☆狼群 提交于 2020-06-01 07:40:28

问题


I am compiling my first GUI Application, I am using pyinstaller because it is the one I know, it generates the .exe file. I am using Python 3.8.1 (tags / v3.8.1: 1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32 on AMD 64Bits.

from tkcalendar import Calendar, DateEntry
from tkinter.ttk import * 
from tkinter import messagebox
from tkinter import *
import datetime
import sqlite3

Then when I go to run the exe file I get this error, please, can you tell me what it refers to or where I can find what the error is about or if there is another more effective way to compile.

This is the text generated by the compiler, I can't read it, I don't see if it describes the error I have here.

I appreciate any help, greetings and thanks in advance. If you can recommend me to continue with pyinstaller or if you can recommend another compiler, I have been trying to compile for 1 week and I feel stagnant since I do not advance, I do not get the error.


回答1:


I use cx_Freeze and I made a GUI which converts py to exe :

import os
import time
from tkinter import *
from tkinter.filedialog import askopenfile
from tkinter.scrolledtext import ScrolledText
from tkinter.messagebox import *

tk = Tk()
tk.title(".py -> .exe")
tk.resizable(0, 0)

f = None

def browse():
    global f, btn
    try:
        f = askopenfile().name # get the py file
        btn["text"] = os.path.basename(f)
    except:
        f = None

def convert():
    global f, btn, ver, des
    OK = False
    try:
        dots = 0
        for x in ver.get(): # check the number of dots in version
            if x == ".":
                dots += 1
            else:
                x = int(x)
        if dots < 4:
            OK = True
    except:
        showwarning("","The version must be int.int.int... with max 3 dots.")
    if OK:
        try:
            if f is None:
                showwarning("","You must choose a file to convert.")
                btn.focus()
            elif ver.get() == "":
                showwarning("","You must enter a version.")
                ver.focus()
            else:
                with open("setup.py", "w") as f_: # fill a new file setup.py (installer)
                    f_.write("NAME = '" + f +
                        "'\nVERSION = '" + ver.get() +
                        "'\nDESCRIPTION = \"\"\"" + des.get(1.0, "end") +
                        "\"\"\"\nFILENAME = '" + f +
                        "'\n\nfrom cx_Freeze import setup, Executable\nsetup(name = NAME, version = VERSION, description = DESCRIPTION, executables = [Executable(FILENAME)])")
                with open("setup.bat", "w") as f_: # fill a new file setup.bat (installation launcher)
                    f_.write("py setup.py build")
                os.system("setup.bat")
                btn["text"] = "Browse..."
                f = None
                os.remove("setup.py")  # remove files created in this script
                os.remove("setup.bat") #
                showinfo("Information","End. Your exe file is in folder 'build'.")
        except:
            showerror("Error","Error detected.")


# create GUI

Label(text="File to convert").grid(column=0, row=0, sticky="w")

btn = Button(text="Browse...", command=browse)
btn.grid(column=1, row=0)

Label(text="Version").grid(column=0, row=2, sticky="w")

ver = Entry()
ver.grid(column=1, row=2, padx=5)

Label(text="Description").grid(column=0, row=3, sticky="w")

des = ScrolledText(width=15, height=5, wrap=WORD)
des.grid(column=1, row=3)

Label(text="Convert to .exe").grid(column=0, row=4, sticky="w")

Button(text="Convert", command=convert).grid(column=1, row=4, pady=5)

tk.mainloop()

Don't forget to install cx_Freeze !



来源:https://stackoverflow.com/questions/62023593/error-compiling-with-pyinstaller-error-loading-python38-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!