问题描述
我对RaspBerry Pi和Python很陌生。我想从我的一个测试脚本中创建一个可执行文件,只是为了检查它是否有效并且可以共享。在下一个步骤中,我想尝试将其编译为Windows。基本上,此文件仅读取xlsx文件并将其拆分为不同的文件。 我在PyInstaller的SO上找到了几篇文章,以及如何解决不同的错误。我最终可以使用不带--onfile标志的pyinstaller,并且新创建的文件按预期运行。当我使用--onefile标志时,整个过程以objcopy错误结束:总共0个字节后,内存不足分配2147483648个字节。 我将这一范围缩小到仅在导入熊猫时出现。.
我使用RaspBerry Pi4 4GB RAM 不幸的是,由于缺少计算机上的管理员权限,我无法在其他计算机上对其进行测试。 只有我发现PyInstaller和objcopy可以使用大约4GB的RAM,因此我想知道错误中指出的大约2.1GB有什么问题... 我还想知道为什么当脚本只有大约180行和10kb时文件变得如此肿...
有人在RaspBerry Pi和PyInstaller上已经处理过这种错误吗?
非常感谢
错误如下:
pi@raspBerrypi:~/Documents/BLANK/Mappen/Installer $ sudo pyinstaller Test03092020.py --hidden-import xlrd --hidden-import xlwt --hidden-import pandas --hidden-import openpyxl --onefile
158 INFO: PyInstaller: 4.0
158 INFO: Python: 3.7.3
160 INFO: Platform: Linux-5.4.51-v7l+-armv7l-with-debian-10.4
161 INFO: wrote /home/pi/Documents/BLANK/Mappen/Installer/Test03092020.spec
173 INFO: UPX is not available.
177 INFO: Extending PYTHONPATH with paths
['/home/pi/Documents/BLANK/Mappen/Installer','/home/pi/Documents/BLANK/Mappen/Installer']
224 INFO: checking Analysis
224 INFO: Building Analysis because Analysis-00.toc is non existent
225 INFO: Initializing module dependency graph...
230 INFO: Caching module graph hooks...
254 INFO: Analyzing base_library.zip ...
9899 INFO: Caching module dependency graph...
10148 INFO: running Analysis Analysis-00.toc
10286 INFO: Analyzing /home/pi/Documents/BLANK/Mappen/Installer/Test03092020.py
12001 INFO: Processing pre-find module path hook distutils from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_find_module_path/hook-distutils.py'.
12005 INFO: distutils: retargeting to non-venv dir '/usr/lib/python3.7'
13170 INFO: Processing pre-safe import module hook six.moves from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-six.moves.py'.
18976 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-setuptools.extern.six.moves.py'.
20213 INFO: Processing pre-find module path hook site from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_find_module_path/hook-site.py'.
20214 INFO: site: retargeting to fake-dir '/usr/local/lib/python3.7/dist-packages/PyInstaller/fake-modules'
62966 INFO: Processing pre-safe import module hook gi.repository.GObject from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.GObject.py'.
62968 INFO: Processing pre-safe import module hook gi.repository.Gtk from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.Gtk.py'.
98979 INFO: Processing module hooks...
98979 INFO: Loading module hook 'hook-cryptography.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
99605 INFO: Loading module hook 'hook-certifi.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
99616 INFO: Loading module hook 'hook-jinja2.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
99671 INFO: Loading module hook 'hook-openpyxl.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
99795 INFO: Loading module hook 'hook-tables.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
99798 INFO: Loading module hook 'hook-lxml.etree.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
99800 INFO: Loading module hook 'hook-IPython.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
100495 INFO: Excluding import 'PyQt4'
100513 INFO: Removing import of PyQt4 from module IPython.external.qt_loaders
100515 INFO: Excluding import 'gtk'
100533 INFO: Excluding import 'PyQt5'
100551 INFO: Removing import of PyQt5.QtWidgets from module IPython.external.qt_loaders
100551 INFO: Removing import of PyQt5 from module IPython.external.qt_loaders
100551 INFO: Removing import of PyQt5.QtSvg from module IPython.external.qt_loaders
100551 INFO: Removing import of PyQt5.QtCore from module IPython.external.qt_loaders
100551 INFO: Removing import of PyQt5.QtGui from module IPython.external.qt_loaders
100553 INFO: Excluding import 'matplotlib'
100568 INFO: Removing import of matplotlib.pyplot from module IPython.core.pylabtools
100568 INFO: Removing import of matplotlib from module IPython.core.pylabtools
100568 INFO: Removing import of matplotlib.figure from module IPython.core.pylabtools
100568 INFO: Removing import of matplotlib._pylab_helpers from module IPython.core.pylabtools
100573 INFO: Excluding import 'PySide'
100589 INFO: Removing import of PySide from module IPython.external.qt_loaders
100592 INFO: Loading module hook 'hook-zmq.py' from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
101145 INFO: Loading module hook 'hook-matplotlib.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
101857 INFO: Loading module hook 'hook-PyQt5.QtSvg.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
102624 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
102626 INFO: Loading module hook 'hook-xml.dom.domreg.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
102628 INFO: Loading module hook 'hook-scipy.special._ellip_harm_2.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
102629 INFO: Loading module hook 'hook-scipy.sparse.csgraph.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
102640 INFO: Loading module hook 'hook-matplotlib.backends.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
104596 INFO: Matplotlib backend "GTK3Agg": added
105771 INFO: Matplotlib backend "GTK3Cairo": added
106704 INFO: Matplotlib backend "MacOSX": ignored
cannot import name '_macosx' from 'matplotlib.backends' (/usr/lib/python3/dist-packages/matplotlib/backends/__init__.py)
108098 INFO: Matplotlib backend "nbAgg": added
109337 INFO: Matplotlib backend "Qt4Agg": added
110442 INFO: Matplotlib backend "Qt4Cairo": added
111533 INFO: Matplotlib backend "Qt5Agg": added
112638 INFO: Matplotlib backend "Qt5Cairo": added
113673 INFO: Matplotlib backend "TkAgg": added
114647 INFO: Matplotlib backend "TkCairo": added
115508 INFO: Matplotlib backend "WebAgg": added
116446 INFO: Matplotlib backend "WX": ignored
No module named 'wx'
117129 INFO: Matplotlib backend "WXAgg": ignored
No module named 'wx'
117812 INFO: Matplotlib backend "WXCairo": ignored
No module named 'wx'
118492 INFO: Matplotlib backend "agg": added
119181 INFO: Matplotlib backend "cairo": added
120132 INFO: Matplotlib backend "pdf": added
121069 INFO: Matplotlib backend "pgf": added
121754 INFO: Matplotlib backend "ps": added
122442 INFO: Matplotlib backend "svg": added
123371 INFO: Matplotlib backend "template": added
125065 INFO: Loading module hook 'hook-PyQt5.QtCore.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
125156 INFO: Loading module hook 'hook-lib2to3.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
125196 INFO: Loading module hook 'hook-pytz.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
125207 INFO: Loading module hook 'hook-sysconfig.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
125237 INFO: Loading module hook 'hook-setuptools.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
126672 INFO: Loading module hook 'hook-PIL.Image.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
127844 INFO: Loading module hook 'hook-gi.repository.Gtk.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
155460 INFO: Processing pre-safe import module hook gi.repository.GLib from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.GLib.py'.
155479 INFO: Processing pre-safe import module hook gi.repository.Gio from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.Gio.py'.
155487 INFO: Processing pre-safe import module hook gi.repository.xlib from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.xlib.py'.
155488 INFO: Processing pre-safe import module hook gi.repository.Gdk from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.Gdk.py'.
155490 INFO: Processing pre-safe import module hook gi.repository.Atk from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.Atk.py'.
155501 INFO: Loading module hook 'hook-PyQt5.QtGui.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
155682 INFO: Loading module hook 'hook-pkg_resources.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
157066 INFO: Processing pre-safe import module hook win32com from '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/pre_safe_import_module/hook-win32com.py'.
157088 WARNING: Hidden import "pkg_resources.py2_warn" not found!
157089 WARNING: Hidden import "pkg_resources.markers" not found!
157107 INFO: Excluding import '__main__'
157116 INFO: Removing import of __main__ from module pkg_resources
157117 INFO: Loading module hook 'hook-PIL.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
157126 INFO: Excluding import 'PyQt4'
157137 INFO: Removing import of PyQt4 from module PIL.ImageQt
157139 INFO: Excluding import 'tkinter'
157151 INFO: Removing import of tkinter from module PIL.ImageTk
157151 INFO: Excluding import 'PyQt5'
157161 INFO: Removing import of PyQt5.QtCore from module PIL.ImageQt
157161 INFO: Removing import of PyQt5.QtGui from module PIL.ImageQt
157164 INFO: Import to be excluded not found: 'FixTk'
157164 INFO: Excluding import 'PySide'
157173 INFO: Removing import of PySide from module PIL.ImageQt
157176 INFO: Loading module hook 'hook-pygments.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
161870 INFO: Loading module hook 'hook-scipy.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
161873 INFO: Loading module hook 'hook-gi.repository.Gdk.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
162294 INFO: Processing pre-safe import module hook gi.repository.cairo from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.cairo.py'.
162297 INFO: Processing pre-safe import module hook gi.repository.Pango from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.Pango.py'.
162299 INFO: Processing pre-safe import module hook gi.repository.GdkPixbuf from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.GdkPixbuf.py'.
162301 INFO: Loading module hook 'hook-scipy.special._ufuncs.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
162303 INFO: Loading module hook 'hook-numpy.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
162304 INFO: Loading module hook 'hook-scipy.stats._stats.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
162308 INFO: Loading module hook 'hook-gi.repository.Gio.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
162981 INFO: Loading module hook 'hook-wcwidth.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
162990 INFO: Loading module hook 'hook-xml.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
162992 INFO: Loading module hook 'hook-pandas.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
165207 INFO: Loading module hook 'hook-_tkinter.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
165550 INFO: checking Tree
165551 INFO: Building Tree because Tree-00.toc is non existent
165552 INFO: Building Tree Tree-00.toc
165576 INFO: checking Tree
165577 INFO: Building Tree because Tree-01.toc is non existent
165577 INFO: Building Tree Tree-01.toc
165587 INFO: Loading module hook 'hook-numpy.core.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
165593 INFO: Loading module hook 'hook-encodings.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
165754 INFO: Loading module hook 'hook-distutils.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
165760 INFO: Loading module hook 'hook-gi.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
165794 INFO: Loading module hook 'hook-gi.repository.cairo.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
166190 INFO: Loading module hook 'hook-gi.repository.GLib.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
166988 INFO: Loading module hook 'hook-PyQt5.QtWidgets.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
167477 INFO: Loading module hook 'hook-PyQt5.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
181770 WARNING: Hidden import "PyQt5.sip" not found!
181771 INFO: Loading module hook 'hook-scipy.linalg.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
181776 INFO: Loading module hook 'hook-gi.repository.GObject.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
182250 WARNING: Hidden import "gi._gobject" not found!
182250 INFO: Loading module hook 'hook-sqlite3.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
182506 INFO: Loading module hook 'hook-gi.repository.Pango.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
182904 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
182926 INFO: Excluding import 'tkinter'
182935 INFO: Import to be excluded not found: 'FixTk'
182935 INFO: Loading module hook 'hook-gi.repository.xlib.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
183277 INFO: Loading module hook 'hook-gi.repository.Atk.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
183746 INFO: Loading module hook 'hook-gi.repository.GdkPixbuf.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
184591 INFO: Processing pre-safe import module hook gi.repository.GModule from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.GModule.py'.
184595 INFO: Loading module hook 'hook-gi.repository.GModule.py' from '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks'...
186197 INFO: Looking for ctypes DLLs
186410 WARNING: library user32 required via ctypes not found
188639 INFO: Analyzing run-time hooks ...
188716 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py'
188727 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_pkgres.py'
188732 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth__tkinter.py'
188735 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_pyqt5.py'
188738 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/rthooks/pyi_rth_traitlets.py'
188741 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/_pyinstaller_hooks_contrib/hooks/rthooks/pyi_rth_certifi.py'
188744 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_gtk.py'
188747 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_gdkpixbuf.py'
188751 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_glib.py'
188753 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_gio.py'
188756 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_gi.py'
188758 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_mplconfig.py'
188761 INFO: Including run-time hook '/usr/local/lib/python3.7/dist-packages/PyInstaller/hooks/rthooks/pyi_rth_mpldata.py'
188886 INFO: Looking for dynamic libraries
210821 INFO: Looking for eggs
210822 INFO: Python library not in binary dependencies. Doing additional searching...
210933 INFO: Using Python library /usr/lib/arm-linux-gnueabihf/libpython3.7m.so.1.0
211032 INFO: Warnings written to /home/pi/Documents/BLANK/Mappen/Installer/build/Test03092020/warn-Test03092020.txt
211734 INFO: Graph cross-reference written to /home/pi/Documents/BLANK/Mappen/Installer/build/Test03092020/xref-Test03092020.html
218568 INFO: checking PYZ
218568 INFO: Building PYZ because PYZ-00.toc is non existent
218568 INFO: Building PYZ (ZlibArchive) /home/pi/Documents/BLANK/Mappen/Installer/build/Test03092020/PYZ-00.pyz
227274 INFO: Building PYZ (ZlibArchive) /home/pi/Documents/BLANK/Mappen/Installer/build/Test03092020/PYZ-00.pyz completed successfully.
227818 INFO: checking PKG
227818 INFO: Building PKG because PKG-00.toc is non existent
227818 INFO: Building PKG (CArchive) PKG-00.pkg
696238 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
702937 INFO: Bootloader /usr/local/lib/python3.7/dist-packages/PyInstaller/bootloader/Linux-32bit-arm/run
702937 INFO: checking EXE
702937 INFO: Building EXE because EXE-00.toc is non existent
702938 INFO: Building EXE from EXE-00.toc
702942 INFO: Appending archive to ELF section in EXE /home/pi/Documents/BLANK/Mappen/Installer/dist/Test03092020
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller",line 10,in <module>
sys.exit(run())
File "/usr/local/lib/python3.7/dist-packages/PyInstaller/__main__.py",line 114,in run
run_build(pyi_config,spec_file,**vars(args))
File "/usr/local/lib/python3.7/dist-packages/PyInstaller/__main__.py",line 65,in run_build
PyInstaller.building.build_main.main(pyi_config,**kwargs)
File "/usr/local/lib/python3.7/dist-packages/PyInstaller/building/build_main.py",line 720,in main
build(specfile,kw.get('distpath'),kw.get('workpath'),kw.get('clean_build'))
File "/usr/local/lib/python3.7/dist-packages/PyInstaller/building/build_main.py",line 667,in build
exec(code,spec_namespace)
File "/home/pi/Documents/BLANK/Mappen/Installer/Test03092020.spec",line 33,in <module>
console=True )
File "/usr/local/lib/python3.7/dist-packages/PyInstaller/building/api.py",line 446,in __init__
self.__postinit__()
File "/usr/local/lib/python3.7/dist-packages/PyInstaller/building/datastruct.py",line 160,in __postinit__
self.assemble()
File "/usr/local/lib/python3.7/dist-packages/PyInstaller/building/api.py",line 616,in assemble
raise SystemError("objcopy Failure: %s" % stderr)
SystemError: objcopy Failure:
objcopy: out of memory allocating 2147483648 bytes after a total of 0 bytes
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)