用pyinstaller打包的几个问题

Several problems when packaging with pyinstaller

我在用 PyInstaller 打包我的 python 程序时,出现了几个问题。下面是我的代码:

#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
from spleeter import separator
import tkinter as TKT
from tkinter import ttk
from tkinter import messagebox
import tensorflow

window = TKT.Tk()
screen_width,screen_height = window.maxsize()
window.title("Spleeter GUI Version")
w = int((screen_width-700)/2)
h = int((screen_height-400)/2)
window.geometry(f'700x400+{w}+{h}')

lbl = TKT.Label(window, text="File Path:")
lbl.grid(column=0, row=0)

txt = TKT.Entry(window, width=10)
txt.grid(column=1, row=0)

lbl2 = TKT.Label(window, text="Stems:")
lbl2.grid(column=0, row=1)

combo = ttk.Combobox(window)
combo['values'] = (2,4,5)
combo.current(0)
combo.grid(column=1, row=1)

def Separation():
    File_name=txt.get();
    stems='spleeter:'+combo.get()+'stems'
    sep = separator.Separator(stems)
    messagebox.showinfo("Notification", "Separation working!")
    sep.separate_to_file(File_name, 'out')
    messagebox.showinfo("Notification", "Separation Finished!")


def clicked():
    Separation()

btn = TKT.Button(window, text="Separate", command=clicked)
btn.grid(column=2, row=0)

def main():
    window.mainloop()

if __name__=='__main__':
    main()

并且在使用PyInstaller打包的时候,终端出现了一些问题:

2015 INFO: PyInstaller: 4.5.1
2016 INFO: Python: 3.8.8 (conda)
2021 INFO: Platform: Windows-10-10.0.19041-SP0
2022 INFO: wrote D:\File\Code\python\Spleeter\helloworld.spec
2081 INFO: UPX is available.
2083 INFO: Extending PYTHONPATH with paths
['D:\File\Code\python\Spleeter', 'D:\File\Code\python\Spleeter']
4046 INFO: checking Analysis
4046 INFO: Building Analysis because Analysis-00.toc is non existent
4046 INFO: Initializing module dependency graph...
4059 INFO: Caching module graph hooks...
4083 INFO: Analyzing base_library.zip ...
13438 INFO: Processing pre-find module path hook distutils from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\pre_find_module_path\hook-distutils.py'.
13439 INFO: distutils: retargeting to non-venv dir 'c:\programdata\anaconda3\lib'
21633 INFO: Caching module dependency graph...
22011 INFO: running Analysis Analysis-00.toc
22032 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\programdata\anaconda3\python.exe
22460 INFO: Analyzing D:\File\Code\python\Spleeter\helloworld.py
29316 INFO: Processing pre-find module path hook site from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\pre_find_module_path\hook-site.py'.
29317 INFO: site: retargeting to fake-dir 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\fake-modules'
Aborted by user request.
PS D:\File\Code\python\Spleeter> ^C
PS D:\File\Code\python\Spleeter> ^C
PS D:\File\Code\python\Spleeter> pyinstaller -D helloworld.py
2023 INFO: PyInstaller: 4.5.1
2023 INFO: Python: 3.8.8 (conda)
2024 INFO: Platform: Windows-10-10.0.19041-SP0
2024 INFO: wrote D:\File\Code\python\Spleeter\helloworld.spec
2082 INFO: UPX is available.
2084 INFO: Extending PYTHONPATH with paths
['D:\File\Code\python\Spleeter', 'D:\File\Code\python\Spleeter']
3988 INFO: checking Analysis
3989 INFO: Building Analysis because Analysis-00.toc is non existent
3989 INFO: Initializing module dependency graph...
4004 INFO: Caching module graph hooks...
4029 INFO: Analyzing base_library.zip ...
13432 INFO: Processing pre-find module path hook distutils from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\pre_find_module_path\hook-distutils.py'.
13434 INFO: distutils: retargeting to non-venv dir 'c:\programdata\anaconda3\lib'
21247 INFO: Caching module dependency graph...
21598 INFO: running Analysis Analysis-00.toc
21619 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\programdata\anaconda3\python.exe
22022 INFO: Analyzing D:\File\Code\python\Spleeter\helloworld.py
28474 INFO: Processing pre-find module path hook site from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\pre_find_module_path\hook-site.py'.
28475 INFO: site: retargeting to fake-dir 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\fake-modules'
67007 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\hook-urllib3.packages.six.moves.py'.
90273 INFO: Processing pre-safe import module hook six.moves from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\hook-six.moves.py'.
119884 INFO: Processing pre-safe import module hook win32com from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\pre_safe_import_module\hook-win32com.py'.
525201 INFO: Processing module hooks...
525201 INFO: Loading module hook 'hook-anyio.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
525957 INFO: Loading module hook 'hook-appdirs.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
525974 INFO: Loading module hook 'hook-argon2.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
525975 INFO: Loading module hook 'hook-bcrypt.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
525976 INFO: Loading module hook 'hook-bokeh.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
532986 INFO: Loading module hook 'hook-certifi.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
533000 INFO: Loading module hook 'hook-cryptography.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
533554 INFO: Loading module hook 'hook-dask.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
533744 INFO: Loading module hook 'hook-docutils.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
539214 INFO: Loading module hook 'hook-h5py.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
539217 INFO: Loading module hook 'hook-IPython.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
540525 INFO: Loading module hook 'hook-jedi.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
544838 INFO: Loading module hook 'hook-jinja2.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
544857 INFO: Loading module hook 'hook-jsonschema.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
544927 INFO: Loading module hook 'hook-llvmlite.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
544940 INFO: Loading module hook 'hook-lxml.etree.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
544942 INFO: Loading module hook 'hook-lxml.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
545951 INFO: Loading module hook 'hook-nacl.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
546016 INFO: Loading module hook 'hook-nbconvert.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
546390 INFO: Loading module hook 'hook-nbformat.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
546578 INFO: Loading module hook 'hook-notebook.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
554119 INFO: Loading module hook 'hook-numba.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
554158 INFO: Loading module hook 'hook-openpyxl.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
554566 INFO: Loading module hook 'hook-pycparser.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
554567 INFO: Loading module hook 'hook-pytest.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
557724 INFO: Loading module hook 'hook-pythoncom.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
559668 INFO: Loading module hook 'hook-pywintypes.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
561629 INFO: Loading module hook 'hook-regex.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
561630 INFO: Loading module hook 'hook-resampy.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
561651 INFO: Loading module hook 'hook-sklearn.cluster.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
567793 INFO: Loading module hook 'hook-sklearn.linear_model.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
573895 INFO: Loading module hook 'hook-sklearn.metrics.cluster.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
573897 WARNING: Hidden import "sklearn.utils.lgamma" not found!
573900 WARNING: Hidden import "sklearn.utils.weight_vector" not found!
573901 INFO: Loading module hook 'hook-sklearn.neighbors.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
580411 INFO: Loading module hook 'hook-sklearn.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
582058 INFO: Loading module hook 'hook-sklearn.tree.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
582060 INFO: Loading module hook 'hook-sklearn.utils.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
582061 INFO: Loading module hook 'hook-soundfile.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
582065 INFO: Loading module hook 'hook-tables.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
582068 INFO: Loading module hook 'hook-tensorflow.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
2021-08-17 11:24:18.101964: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2021-08-17 11:24:18.102134: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
619385 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.premade" not found!
619386 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.layers.experimental" not found!
619387 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.datasets.fashion_mnist" not found!
619391 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.applications.inception_v3" not found!
619392 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.models" not found!
619746 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.keras.constraints" not found!
621119 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.applications.vgg19" not found!
621120 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.premade" not found!
621120 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.applications.resnet_v2" not found!
621121 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.keras.utils" not found!
621125 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.wrappers" not found!
621126 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.keras.applications" not found!
621128 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.estimator" not found!
621133 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.keras.preprocessing.text" not found!
621515 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.keras.metrics" not found!
621516 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.estimator.experimental" not found!
621518 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.datasets.imdb" not found!
621520 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.keras.layers" not found!
621530 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.keras.datasets.imdb" not found!
621531 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.datasets.boston_housing" not found!
621532 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras" not found!
621532 WARNING: Hidden import "tensorflow._api.v2.compat.v2.keras.applications.mobilenet_v2" not found!
621533 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.wrappers.scikit_learn" not found!
621536 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.callbacks" not found!
621538 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.layers.experimental" not found!
621541 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.keras.applications.efficientnet" not found!
622273 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.applications.efficientnet" not found!
622274 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.optimizers.schedules" not found!
623359 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.estimator.export" not found!
623362 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.estimator.inputs" not found!
623363 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.keras" not found!
623366 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.layers.experimental.preprocessing" not found!
623366 WARNING: Hidden import "tensorflow._api.v2.compat.v2.keras.applications.resnet50" not found!
623374 WARNING: Hidden import "tensorflow._api.v2.compat.v2.keras.preprocessing" not found!
623724 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.estimator.inputs" not found!
623725 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.preprocessing.image" not found!
623727 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.estimator" not found!
623734 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.applications" not found!
623737 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.constraints" not found!
624786 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.applications.inception_resnet_v2" not found!
625129 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.applications.densenet" not found!
625130 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.keras.layers" not found!
625148 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.datasets.imdb" not found!
625150 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.keras.initializers" not found!
625157 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.preprocessing" not found!
625158 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.estimator.experimental" not found!
625159 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.estimator" not found!
625159 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.mixed_precision" not found!
625171 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.losses" not found!
625174 WARNING: Hidden import "tensorflow._api.v2.compat.v2.keras.constraints" not found!
625175 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.constraints" not found!
625186 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.keras.datasets.imdb" not found!
625187 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.applications.efficientnet" not found!
625188 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.estimator.export" not found!
626410 WARNING: Hidden import "tensorflow._api.v2.compat.v1.keras.applications.nasnet" not found!
626412 WARNING: Hidden import "tensorflow._api.v2.compat.v2.estimator" not found!
626414 WARNING: Hidden import "tensorflow._api.v2.compat.v1.v1" not found!
626418 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v1.keras.applications.vgg19" not found!
626419 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.datasets.mnist" not found!
626788 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v2.keras.layers.experimental" not found!
626800 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.regularizers" not found!
640280 WARNING: Hidden import "tensorflow._api.v2.compat.v2.keras.applications.densenet" not found!
640282 WARNING: Hidden import "tensorflow._api.v2.compat.v1.estimator.experimental" not found!
640288 WARNING: Hidden import "tensorflow._api.v2.compat.v1.compat.v2.keras.applications.resnet" not found!
640289 WARNING: Hidden import "tensorflow._api.v2.compat.v2.compat.v1.keras.optimizers" not found!
640359 INFO: Loading module hook 'hook-win32com.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
c:\programdata\anaconda3\lib\site-packages\win32com\client\makepy.py:369: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if path is not '' and not os.path.exists(path):
642590 INFO: Loading module hook 'hook-zmq.py' from 'c:\programdata\anaconda3\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'...
646400 INFO: Loading module hook 'hook-babel.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
647110 INFO: Loading module hook 'hook-difflib.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
647128 INFO: Loading module hook 'hook-distutils.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
647130 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
647153 INFO: Loading module hook 'hook-encodings.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
647325 INFO: Loading module hook 'hook-gevent.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
648478 INFO: Determining a mapping of distributions to packages...
900281 WARNING: Unable to find package for requirement zope.interface from package gevent.
900281 WARNING: Unable to find package for requirement zope.event from package gevent.
900282 INFO: Packages required by gevent:
['cffi', 'setuptools', 'greenlet']
902659 INFO: Loading module hook 'hook-heapq.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
902678 INFO: Loading module hook 'hook-importlib_metadata.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
902683 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
902818 INFO: Loading module hook 'hook-matplotlib.backends.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
903953 INFO:   Matplotlib backend "GTK3Agg": ignored
    backend Gtk3Agg requires cairo
904498 INFO:   Matplotlib backend "GTK3Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
905044 INFO:   Matplotlib backend "MacOSX": ignored
    cannot import name '_macosx' from 'matplotlib.backends' (c:\programdata\anaconda3\lib\site-packages\matplotlib\backends\__init__.py)
906697 INFO:   Matplotlib backend "nbAgg": added
<string>:12: MatplotlibDeprecationWarning:
The matplotlib.backends.backend_qt4agg backend was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
907461 INFO:   Matplotlib backend "Qt4Agg": added
908021 INFO:   Matplotlib backend "Qt4Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
908794 INFO:   Matplotlib backend "Qt5Agg": added
909366 INFO:   Matplotlib backend "Qt5Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
910260 INFO:   Matplotlib backend "TkAgg": added
911135 INFO:   Matplotlib backend "TkCairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
912086 INFO:   Matplotlib backend "WebAgg": added
912989 INFO:   Matplotlib backend "WX": added
913909 INFO:   Matplotlib backend "WXAgg": added
914522 INFO:   Matplotlib backend "WXCairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
915194 INFO:   Matplotlib backend "agg": added
915746 INFO:   Matplotlib backend "cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
916593 INFO:   Matplotlib backend "pdf": added
917436 INFO:   Matplotlib backend "pgf": added
918114 INFO:   Matplotlib backend "ps": added
918807 INFO:   Matplotlib backend "svg": added
919640 INFO:   Matplotlib backend "template": added
920548 INFO: Loading module hook 'hook-matplotlib.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
921148 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
921167 INFO: Loading module hook 'hook-numpy.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
921371 INFO: Import to be excluded not found: 'f2py'
921405 INFO: Loading module hook 'hook-numpy._pytesttester.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
921422 INFO: Loading module hook 'hook-packaging.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
921424 INFO: Loading module hook 'hook-pandas.io.formats.style.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
922156 INFO: Loading module hook 'hook-pandas.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
923169 INFO: Loading module hook 'hook-pickle.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
923187 INFO: Loading module hook 'hook-PIL.Image.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
924017 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
924036 INFO: Loading module hook 'hook-PIL.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
924088 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
924106 INFO: Loading module hook 'hook-pkg_resources.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
927054 WARNING: Hidden import "pkg_resources.py2_warn" not found!
927055 WARNING: Hidden import "pkg_resources.markers" not found!
927073 INFO: Loading module hook 'hook-pygments.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
929382 INFO: Loading module hook 'hook-PyQt5.py' from 'c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks'...
Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\programdata\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 126, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 815, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 762, in build
    exec(code, spec_namespace)
  File "D:\File\Code\python\Spleeter\helloworld.spec", line 7, in <module>
    a = Analysis(['helloworld.py'],
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 294, in __init__
    self.__postinit__()
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 159, in __postinit__
    self.assemble()
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 473, in assemble
    self.graph.process_post_graph_hooks(self)
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 373, in process_post_graph_hooks
    module_hook.post_graph(analysis)
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\depend\imphook.py", line 451, in post_graph
    self._load_hook_module()
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\depend\imphook.py", line 408, in _load_hook_module
    self._hook_module = importlib_load_source(
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\compat.py", line 632, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 962, in load_module
  File "<frozen importlib._bootstrap_external>", line 787, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\hooks\hook-PyQt5.py", line 11, in <module>
    from PyInstaller.utils.hooks.qt import pyqt5_library_info, \
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 162, in <module>
    pyqt5_library_info = QtLibraryInfo('PyQt5')
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 54, in __init__
    if hooks.is_module_satisfies("PyQt5 >= 5.15.4"):
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 502, in is_module_satisfies
    version = get_module_attribute(module_name, version_attr)
  File "c:\programdata\anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 352, in get_module_attribute
    raise AttributeError(
AttributeError: Module 'PyQt5' has no attribute '__version__'

(由于字数限制,删除了上面类似'Hidden Import'的一些错误。)

主要有两个问题:

  1. 隐藏的导入问题
  2. 属性错误。 以及其他我没有注意到的问题

我是 python 和 PyInstaller 的新手。这些问题可能很愚蠢。非常感谢你帮助我。

这似乎是一个简单的错误,它看起来像是您尝试导入您没有的库,使用命令提示符您应该能够做到

pip install tkinter

和任何其他包,如果你有这些,那么它不会下载,如果你没有,它会,否则它可能只是一个简单的丢失文件或路径错误。

您需要在 pyinstaller 命令中排除 PyQt5 库。 在 pyinstaller 命令中添加以下命令。

--exclude-module "PyQt5"

您可以使用 auto-py-to-exe 应用程序创建 exe。此应用程序使用 pyinstaller 库。真的好办。