pyinstaller pythonfile.py
C:\Users\fpt84\Downloads\Case>pyinstaller Reserve_estimation.py
1922 INFO: PyInstaller: 3.5
1922 INFO: Python: 3.7.5
1922 INFO: Platform: Windows-10-10.0.17134-SP0
1922 INFO: wrote C:\Users\fpt84\Downloads\Case\Reserve_estimation.spec
1922 INFO: UPX is not available.
1938 INFO: Extending PYTHONPATH with paths
['C:\\Users\\fpt84\\Downloads\\Case', 'C:\\Users\\fpt84\\Downloads\\Case']
1938 INFO: checking Analysis
1938 INFO: Building Analysis because Analysis-00.toc is non existent
1938 INFO: Initializing module dependency graph...
1938 INFO: Initializing module graph hooks...
2060 INFO: Analyzing base_library.zip ...
15631 INFO: running Analysis Analysis-00.toc
15662 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\program files (x86)\python37-32\python.exe
16855 INFO: Caching module hooks...
16873 INFO: Analyzing C:\Users\fpt84\Downloads\Case\Reserve_estimation.py
18930 INFO: Processing pre-find module path hook distutils
23013 INFO: Processing pre-find module path hook site
23028 INFO: site: retargeting to fake-dir 'c:\\program files (x86)\\python37-32\\lib\\site-packages\\PyInstaller\\fake-modules'
27858 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
44127 INFO: Processing pre-safe import module hook six.moves
90015 INFO: Loading module hooks...
90015 INFO: Loading module hook "hook-distutils.py"...
90031 INFO: Loading module hook "hook-encodings.py"...
90263 INFO: Loading module hook "hook-lib2to3.py"...
90331 INFO: Loading module hook "hook-matplotlib.backends.py"...
93743 INFO: Matplotlib backend "GTK3Agg": ignored
The GTK3 backends require PyGObject
94880 INFO: Matplotlib backend "GTK3Cairo": ignored
The GTK3 backends require PyGObject
95961 INFO: Matplotlib backend "MacOSX": ignored
cannot import name '_macosx' from 'matplotlib.backends' (c:\program files (x86)\python37-32\lib\site-packages\matplotlib\backends\__init__.py)
96785 INFO: Matplotlib backend "nbAgg": ignored
No module named 'IPython'
97650 INFO: Matplotlib backend "Qt4Agg": ignored
Failed to import any qt binding
98536 INFO: Matplotlib backend "Qt4Cairo": ignored
Failed to import any qt binding
167586 INFO: Matplotlib backend "Qt5Agg": ignored
Failed to import any qt binding
168446 INFO: Matplotlib backend "Qt5Cairo": ignored
Failed to import any qt binding
170140 INFO: Matplotlib backend "TkAgg": added
171297 INFO: Matplotlib backend "TkCairo": added
173180 INFO: Matplotlib backend "WebAgg": added
174578 INFO: Matplotlib backend "WX": ignored
No module named 'wx'
175414 INFO: Matplotlib backend "WXAgg": ignored
No module named 'wx'
176309 INFO: Matplotlib backend "WXCairo": ignored
No module named 'wx'
177333 INFO: Matplotlib backend "agg": added
178893 INFO: Matplotlib backend "cairo": added
180276 INFO: Matplotlib backend "pdf": added
181562 INFO: Matplotlib backend "pgf": added
182493 INFO: Matplotlib backend "ps": added
183380 INFO: Matplotlib backend "svg": added
184500 INFO: Matplotlib backend "template": added
186040 INFO: Loading module hook "hook-matplotlib.py"...
186772 INFO: Loading module hook "hook-numpy.core.py"...
187104 INFO: Loading module hook "hook-numpy.py"...
187104 INFO: Loading module hook "hook-pandas.py"...
195599 INFO: Loading module hook "hook-patsy.py"...
195615 INFO: Loading module hook "hook-pkg_resources.py"...
196332 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
196493 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
197019 INFO: Loading module hook "hook-pydoc.py"...
197019 INFO: Loading module hook "hook-pytz.py"...
197173 INFO: Loading module hook "hook-scipy.linalg.py"...
197173 INFO: Loading module hook "hook-scipy.py"...
197188 INFO: Loading module hook "hook-scipy.sparse.csgraph.py"...
197220 INFO: Loading module hook "hook-scipy.special._ellip_harm_2.py"...
197235 INFO: Loading module hook "hook-scipy.special._ufuncs.py"...
197235 INFO: Loading module hook "hook-setuptools.py"...
198538 INFO: Loading module hook "hook-sqlite3.py"...
198845 INFO: Loading module hook "hook-sysconfig.py"...
198876 INFO: Loading module hook "hook-xml.dom.domreg.py"...
198876 INFO: Loading module hook "hook-xml.py"...
198876 INFO: Loading module hook "hook-_tkinter.py"...
199320 INFO: checking Tree
199321 INFO: Building Tree because Tree-00.toc is non existent
199321 INFO: Building Tree Tree-00.toc
199542 INFO: checking Tree
199542 INFO: Building Tree because Tree-01.toc is non existent
199543 INFO: Building Tree Tree-01.toc
199887 INFO: Looking for ctypes DLLs
200066 INFO: Analyzing run-time hooks ...
200110 INFO: Including run-time hook 'pyi_rth_pkgres.py'
200300 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
200391 INFO: Including run-time hook 'pyi_rth__tkinter.py'
200512 INFO: Including run-time hook 'pyi_rth_mplconfig.py'
200543 INFO: Including run-time hook 'pyi_rth_mpldata.py'
200614 INFO: Looking for dynamic libraries
201371 WARNING: lib not found: libdcosqb.BSF6YTIPIV6BF3DZBNWD4YMH3UDU6DI7.gfortran-win32.dll dependency of c:\program files (x86)\python37-32\lib\site-packages\scipy\fftpack\convolve.cp37-win32.pyd
201448 WARNING: lib not found: libdcosqb.3VZOXZKO53O75NWVYHOUJGPASB2ZKGJ5.gfortran-win32.dll dependency of c:\program files (x86)\python37-32\lib\site-packages\scipy\fftpack\_fftpack.cp37-win32.pyd
201697 WARNING: lib not found: libopenblas.FN5FF57TWHUYLRG54LA6B33EZPHYZZL4.gfortran-win32.dll dependency of c:\program files (x86)\python37-32\lib\site-packages\scipy\linalg\_fblas.cp37-win32.pyd
201735 WARNING: lib not found: libwrap_dum.O73B2JX3DJYML5H4BWW5Q3A3HBJAOPZ6.gfortran-win32.dll dependency of c:\program files (x86)\python37-32\lib\site-packages\scipy\linalg\_fblas.cp37-win32.pyd
201813 WARNING: lib not found: libopenblas.FN5FF57TWHUYLRG54LA6B33EZPHYZZL4.gfortran-win32.dll dependency of c:\program files (x86)\python37-32\lib\site-packages\scipy\linalg\_flapack.cp37-win32.pyd
201851 WARNING: lib not found: libwrap_dum.IRYJBAZYKKFICXK5GWMZM56G37UL5UQD.gfortran-win32.dll dependency of c:\program files (x86)\python37-32\lib\site-packages\scipy\linalg\_flapack.cp37-win32.pyd
201919 WARNING: lib not found: libdet.5CWEKK7ZP27J2ASOWSCQ2Q7EMBKUXI6K.gfortran-win32.dll dependency of c:\program files (x86)\python37-32\lib\site-packages\scipy\linalg\_flinalg.cp37-win32.pyd
.
.
.
.
255561 INFO: Building PKG because PKG-00.toc is non existent
255576 INFO: Building PKG (CArchive) PKG-00.pkg
255777 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
255793 INFO: Bootloader c:\program files (x86)\python37-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
255793 INFO: checking EXE
255793 INFO: Building EXE because EXE-00.toc is non existent
255793 INFO: Building EXE from EXE-00.toc
255824 INFO: Appending archive to EXE C:\Users\fpt84\Downloads\Case\build\Reserve_estimation\Reserve_estimation.exe
256031 INFO: Building EXE from EXE-00.toc completed successfully.
256046 INFO: checking COLLECT
256046 INFO: Building COLLECT because COLLECT-00.toc is non existent
256046 INFO: Building COLLECT COLLECT-00.toc
350779 INFO: Building COLLECT COLLECT-00.toc completed successfully.
我尝试过手动安装一些缺少的模块,但这似乎是一个无尽的过程,如运行日志所示,该过程成功结束。 当我从dist文件夹运行可执行文件时,它会打开一个cmd窗口,显示了几行初始化,但是突然输出了一些失败行,在cmd窗口关闭之前,我什至没有时间读取这些失败行。
答案 0 :(得分:0)
发现您的错误(我认为)。
执行失败的堆栈跟踪为
ImportError:没有名为“ numpy.random.common”的模块。对此进行谷歌搜索,这似乎是一个常见问题,并且已在In PyInstaller, Why Won't NumPy.Random.Common Load as a Module?中确定了解决方法。
解决方法是在编译前在失败的脚本开头添加三行。
import numpy.random.common
import numpy.random.bounded_integers
import numpy.random.entropy
这样做,我编译了可执行文件,然后 Voila!
它跑了。但是,我确实收到了关于某些matplotlib的警告,但是我很快就删除了该功能,但该功能并未出现在我所看到的源程序的控制台运行中,因此您可能要修复该问题。
此外,我在代码结尾处将time.sleep(1000)
调用替换为input('Press enter to exit...')
。