ubuntu上的Pyinstaller抛出异常PyInstaller.compat.FileNotFoundError

时间:2015-10-23 21:37:19

标签: pyinstaller

运行

pyinstaller myfile.spec

下面的Tracebacok

Traceback (most recent call last):
  File "/usr/local/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==3.0', 'console_scripts', 'pyinstaller')()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 99, in run
    run_build(opts, spec_file, pyi_config)
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 47, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **opts.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 737, 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 680, in build
    exec(text, spec_namespace)
  File "<string>", line 6, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 207, in __init__
    self.__postinit__()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/datastruct.py", line 156, in __postinit__
    self.assemble()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 430, in assemble
    imphook_object.update_dependencies(self.graph)
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/imphook.py", line 345, in update_dependencies
    self._process_datas(mod_graph)
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/imphook.py", line 313, in _process_datas
    self.datas.update(set(format_binaries_and_datas(self._module.datas)))
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/utils.py", line 422, in format_binaries_and_datas
    src_root_path_or_glob))
PyInstaller.compat.FileNotFoundError: Path or glob "/usr/include/python2.7/pyconfig.h" not found or matches no files.

1 个答案:

答案 0 :(得分:8)

Pyinstaller需要一个Ubuntu包,因为它有几个依赖项。这没有记录,但您需要python-dev

apt install build-essential python-dev