启动Exe时出现FileNotFoundError

时间:2020-06-25 09:17:24

标签: python tkinter exe

我用Tkinter创建了一个GUI,其中包含工具提示。为了创建工具提示,我使用了软件包Pmw.Balloon

当我从脚本使用Pyinstaller创建可执行文件并启动exe时,出现FileNotFoundError:

enter image description here

我使用Anaconda-Jupyter Notebook,并在一个环境中安装了所有Python软件包(包括Pmw)。你们谁知道我该如何解决这个错误?

编辑2:

我发现错误的原因。 Pyinstaller不包含/加载Pmw软件包。

编辑1:

仅从exe引发此FileNotFoundEroor,而不是在直接执行主Python文件时引发。

创建exe时的其他信息:

(base) C:\Users\....\Desktop\Code>pyinstaller --onefile test.py
207 INFO: PyInstaller: 3.6
208 INFO: Python: 3.7.4 (conda)
209 INFO: Platform: Windows-10-10.0.17763-SP0
225 INFO: wrote C:\Users\....\Desktop\Code\test.spec
232 INFO: UPX is not available.
236 INFO: Extending PYTHONPATH with paths
['C:\\Users\\....\\Desktop\\Code', 'C:\\Users\\....\\Desktop\\Code']
237 INFO: checking Analysis
238 INFO: Building Analysis because Analysis-00.toc is non existent
238 INFO: Initializing module dependency graph...
262 INFO: Caching module graph hooks...
288 INFO: Analyzing base_library.zip ...
12229 INFO: Caching module dependency graph...
12637 INFO: running Analysis Analysis-00.toc
12685 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\....\appdata\local\continuum\anaconda3\python.exe
14030 INFO: Analyzing C:\Users\....\Desktop\Code\test.py
16703 INFO: Processing pre-find module path hook   distutils
16709 INFO: distutils: retargeting to non-venv dir 'c:\\users\\....\\appdata\\local\\continuum\\anaconda3\\lib'
20840 INFO: Processing pre-find module path hook   site
20845 INFO: site: retargeting to fake-dir 'c:\\users\\....\\appdata\\local\\continuum\\anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
27447 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
48638 INFO: Processing pre-safe import module hook   six.moves
65399 INFO: Processing pre-safe import module hook   urllib3.packages.six.moves
122663 INFO: Processing module hooks...
122663 INFO: Loading module hook "hook-babel.py"...
122929 INFO: Loading module hook "hook-certifi.py"...
122936 INFO: Loading module hook "hook-Crypto.py"...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'Crypto.Math'
123126 INFO: Loading module hook "hook-cryptography.py"...
124300 INFO: Loading module hook "hook-distutils.py"...
124306 INFO: Loading module hook "hook-docutils.py"...
129334 INFO: Loading module hook "hook-encodings.py"...
129546 INFO: Loading module hook "hook-importlib_metadata.py"...
129558 INFO: Loading module hook "hook-IPython.py"...
132300 INFO: Excluding import 'tkinter'
132310 INFO:   Removing import of tkinter from module IPython.lib.clipboard
132312 INFO: Excluding import 'gtk'
132323 INFO: Excluding import 'matplotlib'
132335 INFO:   Removing import of matplotlib._pylab_helpers from module IPython.core.pylabtools
132336 INFO:   Removing import of matplotlib.figure from module IPython.core.pylabtools
132337 INFO:   Removing import of matplotlib from module IPython.core.pylabtools
132338 INFO:   Removing import of matplotlib.pyplot from module IPython.core.pylabtools
132343 INFO: Excluding import 'PyQt4'
132355 INFO:   Removing import of PyQt4 from module IPython.external.qt_loaders
132357 INFO: Excluding import 'PySide'
132370 INFO:   Removing import of PySide from module IPython.external.qt_loaders
132372 INFO: Excluding import 'PyQt5'
132381 INFO:   Removing import of PyQt5.QtSvg from module IPython.external.qt_loaders
132381 INFO:   Removing import of PyQt5.QtWidgets from module IPython.external.qt_loaders
132383 INFO:   Removing import of PyQt5.QtCore from module IPython.external.qt_loaders
132384 INFO:   Removing import of PyQt5.QtGui from module IPython.external.qt_loaders
132385 INFO:   Removing import of PyQt5 from module IPython.external.qt_loaders
132388 INFO: Loading module hook "hook-jedi.py"...
132886 INFO: Loading module hook "hook-jinja2.py"...
132995 INFO: Loading module hook "hook-jsonschema.py"...
133011 INFO: Loading module hook "hook-lib2to3.py"...
133023 INFO: Loading module hook "hook-matplotlib.backends.py"...
136628 INFO:   Matplotlib backend "GTK3Agg": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
137407 INFO:   Matplotlib backend "GTK3Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
138701 INFO:   Matplotlib backend "MacOSX": ignored
    cannot import name '_macosx' from 'matplotlib.backends' (c:\users\....\appdata\local\continuum\anaconda3\lib\site-packages\matplotlib\backends\__init__.py)
141186 INFO:   Matplotlib backend "nbAgg": added
143339 INFO:   Matplotlib backend "Qt4Agg": added
144384 INFO:   Matplotlib backend "Qt4Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
145837 INFO:   Matplotlib backend "Qt5Agg": added
146807 INFO:   Matplotlib backend "Qt5Cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
148102 INFO:   Matplotlib backend "TkAgg": added
149156 INFO:   Matplotlib backend "TkCairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
150342 INFO:   Matplotlib backend "WebAgg": added
151462 INFO:   Matplotlib backend "WX": ignored
    No module named 'wx'
152388 INFO:   Matplotlib backend "WXAgg": ignored
    No module named 'wx'
153343 INFO:   Matplotlib backend "WXCairo": ignored
    No module named 'wx'
154339 INFO:   Matplotlib backend "agg": added
155198 INFO:   Matplotlib backend "cairo": ignored
    cairo backend requires that pycairo>=1.11.0 or cairocffiis installed
156241 INFO:   Matplotlib backend "pdf": added
157287 INFO:   Matplotlib backend "pgf": added
158123 INFO:   Matplotlib backend "ps": added
158968 INFO:   Matplotlib backend "svg": added
160022 INFO:   Matplotlib backend "template": added
160810 INFO: Loading module hook "hook-matplotlib.py"...
161561 INFO: Loading module hook "hook-nbconvert.py"...
161610 INFO: Loading module hook "hook-nbformat.py"...
161630 INFO: Loading module hook "hook-notebook.py"...
166746 INFO: Loading module hook "hook-numpy.core.py"...
166991 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
167001 INFO: Loading module hook "hook-numpy.py"...
167006 INFO: Loading module hook "hook-PIL.Image.py"...
168235 INFO: Loading module hook "hook-PIL.py"...
168246 INFO: Excluding import 'tkinter'
168251 INFO:   Removing import of tkinter from module PIL.ImageTk
168255 INFO: Import to be excluded not found: 'FixTk'
168256 INFO: Excluding import 'PyQt4'
168263 INFO:   Removing import of PyQt4 from module PIL.ImageQt
168264 INFO: Excluding import 'PySide'
168271 INFO:   Removing import of PySide from module PIL.ImageQt
168273 INFO: Excluding import 'PyQt5'
168279 INFO:   Removing import of PyQt5.QtCore from module PIL.ImageQt
168279 INFO:   Removing import of PyQt5.QtGui from module PIL.ImageQt
168281 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
168293 INFO: Excluding import 'tkinter'
168298 INFO: Import to be excluded not found: 'FixTk'
168298 INFO: Loading module hook "hook-pkg_resources.py"...
169883 INFO: Processing pre-safe import module hook   win32com
170754 INFO: Excluding import '__main__'
170759 INFO:   Removing import of __main__ from module pkg_resources
170759 INFO: Loading module hook "hook-pycparser.py"...
170764 INFO: Loading module hook "hook-pydoc.py"...
170770 INFO: Loading module hook "hook-pygments.py"...
175041 INFO: Loading module hook "hook-PyQt5.py"...
176374 WARNING: Hidden import "PyQt5.sip" not found!
176374 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
176799 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
177238 INFO: Loading module hook "hook-PyQt5.QtSvg.py"...
178125 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
178871 INFO: Loading module hook "hook-pytest.py"...
181453 INFO: Loading module hook "hook-pythoncom.py"...
182802 INFO: Loading module hook "hook-pytz.py"...
183007 INFO: Loading module hook "hook-pywintypes.py"...
184144 INFO: Loading module hook "hook-scipy.linalg.py"...
184149 INFO: Loading module hook "hook-scipy.py"...
184156 INFO: Loading module hook "hook-scipy.sparse.csgraph.py"...
184170 INFO: Loading module hook "hook-scipy.special._ellip_harm_2.py"...
184174 INFO: Loading module hook "hook-scipy.special._ufuncs.py"...
184179 INFO: Loading module hook "hook-setuptools.py"...
186259 INFO: Loading module hook "hook-sphinx.py"...
200804 INFO: Loading module hook "hook-sqlite3.py"...
201025 INFO: Loading module hook "hook-sysconfig.py"...
201030 INFO: Loading module hook "hook-win32com.py"...
202494 INFO: Loading module hook "hook-xml.dom.domreg.py"...
202499 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
202504 INFO: Loading module hook "hook-xml.py"...
202511 INFO: Loading module hook "hook-zmq.py"...
207967 INFO: Loading module hook "hook-_tkinter.py"...
208496 INFO: checking Tree
208496 INFO: Building Tree because Tree-00.toc is non existent
208497 INFO: Building Tree Tree-00.toc
208735 INFO: checking Tree
208735 INFO: Building Tree because Tree-01.toc is non existent
208736 INFO: Building Tree Tree-01.toc
208775 INFO: Loading module hook "hook-gevent.py"...
209451 INFO: Determining a mapping of distributions to packages...
370757 WARNING: Unable to find package for requirement greenlet from package gevent.
370757 INFO: Packages required by gevent:
['cffi']
375108 INFO: Loading module hook "hook-lxml.etree.py"...
375550 INFO: Looking for ctypes DLLs
375901 INFO: Analyzing run-time hooks ...
375937 INFO: Including run-time hook 'pyi_rth_pkgres.py'
375946 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
375957 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
375970 INFO: Including run-time hook 'pyi_rth_traitlets.py'
375978 INFO: Including run-time hook 'pyi_rth_certifi.py'
375986 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
375995 INFO: Including run-time hook 'pyi_rth_mplconfig.py'
376002 INFO: Including run-time hook 'pyi_rth_mpldata.py'
376010 INFO: Including run-time hook 'pyi_rth__tkinter.py'
376131 INFO: Looking for dynamic libraries
377279 WARNING: lib not found: msmpi.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_blacs_msmpi_ilp64.dll
377306 WARNING: lib not found: impi.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_blacs_intelmpi_lp64.dll
377839 WARNING: lib not found: msmpi.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_blacs_msmpi_lp64.dll
379576 WARNING: lib not found: pgc14.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_pgi_thread.dll
379578 WARNING: lib not found: pgf90rtl.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_pgi_thread.dll
379581 WARNING: lib not found: pgf90.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_pgi_thread.dll
381124 WARNING: lib not found: impi.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_blacs_intelmpi_ilp64.dll
381172 WARNING: lib not found: mpich2mpi.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_blacs_mpich2_ilp64.dll
381279 WARNING: lib not found: mpich2mpi.dll dependency of c:\users\....\appdata\local\continuum\anaconda3\Library\bin\mkl_blacs_mpich2_lp64.dll
387553 INFO: Looking for eggs
387554 INFO: Using Python library c:\users\....\appdata\local\continuum\anaconda3\python37.dll
387555 INFO: Found binding redirects:
[]
387632 INFO: Warnings written to C:\Users\....\Desktop\Code\build\test\warn-test.txt
388866 INFO: Graph cross-reference written to C:\Users\....\Desktop\Code\build\test\xref-test.html
389262 INFO: checking PYZ
389262 INFO: Building PYZ because PYZ-00.toc is non existent
389265 INFO: Building PYZ (ZlibArchive) C:\Users\....\Desktop\Code\build\test\PYZ-00.pyz
395965 INFO: Building PYZ (ZlibArchive) C:\Users\....\Desktop\Code\build\test\PYZ-00.pyz completed successfully.
396257 INFO: checking PKG
396257 INFO: Building PKG because PKG-00.toc is non existent
396258 INFO: Building PKG (CArchive) PKG-00.pkg
575871 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
576232 INFO: Bootloader c:\users\....\appdata\local\continuum\anaconda3\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
576233 INFO: checking EXE
576234 INFO: Building EXE because EXE-00.toc is non existent
576236 INFO: Building EXE from EXE-00.toc
576238 INFO: Appending archive to EXE C:\Users\....\Desktop\Code\dist\test.exe
576660 INFO: Building EXE from EXE-00.toc completed successfully.

0 个答案:

没有答案
相关问题