Pyinstaller 无法在 Python2.7 64 位 Ubuntu 中编译大型程序
Pyinstaller Not Compiling Large Program in Python2.7 64-Bit Ubuntu
我在使用 Pyinstaller 编译我的 Python 程序时遇到了一些困难。我的程序有多个模块和大约 2000 行代码。它使用 TaurusScada 作为 PYQT、Numpy 和其他一些模块的包装器。该平台是 Python 2.7 和 Ubuntu 15.04。我也在使用 Pyinstaller 3.1。我成功地编译了一个小型 "Hello World" 类型的应用程序,所以我知道它可以工作。我没有与 Pyinstaller 结婚,因为我也尝试过 cx_Freeze 但没有成功。我不会将我的整个代码留在此处,而是先留下回溯和错误,希望有人能对此有所启发:
66874 INFO: Processing hook hook-gi.repository.GdkPixbuf.py
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 755, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 701, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 212, in __init__
self.__postinit__()
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/datastruct.py", line 183, in __postinit__
self.assemble()
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 432, in assemble
imphook_object = ImportHook(imported_name, hook_file)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/imphook.py", line 182, in __init__
self._module = importlib_load_source(hook_modname, self._filename)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py", line 36, in <module>
cachedata = subprocess.check_output('gdk-pixbuf-query-loaders')
File "/usr/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
非常感谢任何帮助。
我今天遇到了类似的错误。您缺少 gdk-pixbuf 库:
所以 运行:
sudo apt-get install libgdk-pixbuf2.0-dev
pyinstaller 应该会很顺利
我在使用 Pyinstaller 编译我的 Python 程序时遇到了一些困难。我的程序有多个模块和大约 2000 行代码。它使用 TaurusScada 作为 PYQT、Numpy 和其他一些模块的包装器。该平台是 Python 2.7 和 Ubuntu 15.04。我也在使用 Pyinstaller 3.1。我成功地编译了一个小型 "Hello World" 类型的应用程序,所以我知道它可以工作。我没有与 Pyinstaller 结婚,因为我也尝试过 cx_Freeze 但没有成功。我不会将我的整个代码留在此处,而是先留下回溯和错误,希望有人能对此有所启发:
66874 INFO: Processing hook hook-gi.repository.GdkPixbuf.py
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 755, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 701, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 212, in __init__
self.__postinit__()
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/datastruct.py", line 183, in __postinit__
self.assemble()
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 432, in assemble
imphook_object = ImportHook(imported_name, hook_file)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/imphook.py", line 182, in __init__
self._module = importlib_load_source(hook_modname, self._filename)
File "/usr/local/lib/python2.7/dist-packages/PyInstaller/hooks/hook-gi.repository.GdkPixbuf.py", line 36, in <module>
cachedata = subprocess.check_output('gdk-pixbuf-query-loaders')
File "/usr/lib/python2.7/subprocess.py", line 566, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
非常感谢任何帮助。
我今天遇到了类似的错误。您缺少 gdk-pixbuf 库:
所以 运行:
sudo apt-get install libgdk-pixbuf2.0-dev
pyinstaller 应该会很顺利