pyinstaller无法说它找不到pyexcel.ext.ods但是被包含了好几次

时间:2015-04-08 20:23:50

标签: python linux pyinstaller

我试图在linux中构建一个可执行文件。我已经构建了我的.spec文件以包含警告文本中的所有内容。我几乎没有接近成功的构建。我想在得到一个好的编译后我可以清除不必要的库。我终于编译没有任何调试错误。感谢安装64位 sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

当我从终端运行程序时,我得到了一个我不应该得到的错误。我在spec文件中包含pyexcel.ext.ods,因为它位于warning.txt文件中,以及声明为import pyexcel.ext.ods的脚本顶部以及单独的函数文件。错误来自我从中导入函数的函数文件。错误如下。

LOADER: executable is /home/thisGuy/Desktop/keep/keep
LOADER: homepath is /home/thisGuy/Desktop/keep
LOADER: _MEIPASS2 is NULL
LOADER: archivename is /home/thisGuy/Desktop/keep/keep
LOADER: Extracting binaries
LOADER: Executing self as child
LOADER: LD_LIBRARY_PATH=/home/thisGuy/Desktop/keep
LOADER: executable is /home/thisGuy/Desktop/keep/keep
LOADER: homepath is /home/thisGuy/Desktop/keep
LOADER: _MEIPASS2 is /home/thisGuy/Desktop/keep
LOADER: archivename is /home/thisGuy/Desktop/keep/keep
LOADER: Already in the child - running user's code.
LOADER: Python library: /home/thisGuy/Desktop/keep/libpython2.7.so.1.0
LOADER: Manipulating evironment
LOADER: PYTHONPATH=/home/thisGuy/Desktop/keep
LOADER: PYTHONHOME=/home/thisGuy/Desktop/keep
LOADER: Manipulating Python's sys.path
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: extracted pyi_os_path
LOADER: extracted pyi_archive
LOADER: extracted pyi_importers
LOADER: Installing import hooks
LOADER: out00-PYZ.pyz
LOADER: Running scripts
Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "/home/thisGuy/Dropbox/python/myPy/keep/build/keep/out00-PYZ.pyz/cDTf", line 4, in <module>
  File "/home/thisGuy/Dropbox/python/myPy/keep/build/keep/out00-PYZ.pyz/pyexcel.exthook", line 117, in load_module
ImportError: No module named pyexcel.ext.ods
LOADER: RC: -1 from keep
LOADER: OK.
LOADER: Cleaning up Python interpreter.
LOADER: Back to parent
LOADER: Doing cleanup
LOADER: Freeing archive status for /home/thisGuy/Desktop/keep/keep

我的第一个问题是如何使上述错误消失?我已将pyexcel库以及pyexcel.ext.ods包含在每个文件的头部,而非直接非条件imports 我的spec文件看起来像这样。我知道它有点矫枉过正!我知道我不需要pydoc等......但是为了安全起见,我提出了所有警告。

# -*- mode: python -*-
a = Analysis(['keep.py'],
             pathex=['/usr/local/lib/python2.7/dist-packages/pyexcel',
            '/usr/local/lib/python2.7/dist-packages/pyexcel_io',
            '/usr/local/lib/python2.7/dist-packages/pyexcel_ods',
            '/usr/local/lib/python2.7/dist-packages/pyexcel_xls',
            '/usr/local/lib/python2.7/dist-packages/ezodf',
            '/home/thisGuy/Dropbox/python/myPy/keepLinux'],
             hiddenimports=['_dummy_threading',
            'pydoc ',
            'bdb ',
            'nt',
            'nt',
            'pyexcel.sheets.load_from_memory',
            'pyexcel.ext.xls',
            '_emx_link',
            'msvcrt',
            'collections ',
            'pyexcel_io.DEFAULT_SHEETNAME',
            'hashlib ',
            'pyexcel.sheets.Matrix',
            'pyexcel._compact ',
            'nt',
            'pyexcel.io.BytesIO',
            'pyexcel_io.SheetWriter',
            'pyexcel_io.BookReader',
            'EasyDialogs',
            'pyexcel.ext.ods',
            'optik',
            'rourl2path',
            'pdb ',
            'pyexcel.sheets.transpose',
            'rourl2path',
            'optparse ',
            'pyexcel.sheets.Sheet',
            'pyexcel_io.SheetReaderBase',
            '_winreg',
            'encodings ',
            '_subprocess',
            '_dummy_threading',
            'doctest ',
            'pyi_archive ',
            'pyexcel.sheets.load_from_dict',
            'pyexcel.sheets.SeriesReader',
            'pyexcel_io.SheetReaderBase',
            'pyexcel_io.SheetReaderBase',
            'optik',
            'pyi_importers ',
            'io.StringIO',
            'io.BytesIO',
            'pyexcel.exthook ',
            'org',
            'warnings ',
            'msvcrt',
            'pyexcel_io.SheetWriter',
            'tokenize ',
            'pickle ',
            'pyexcel_io.BookReader',
            'pyexcel.sheets.NominableSheet',
            'pyexcel_io.DEFAULT_SHEETNAME',
            'pyexcel_io.NamedContent',
            'ordereddict',
            '_sysconfigdata_d',
            'pyexcel.io.get_writer',
            'pyexcel.sheets.get_sheet',
            'pyexcel_io.BookWriter',
            'pyexcel_io.BookWriter',
            'pyexcel_io.BookWriter',
            'nt',
            'email ',
            'cl',
            'pyexcel.sheets.load_from_django_model',
            'pyexcel.io.BytesIO',
            '_scproxy',
            '_subprocess',
            'pyexcel.io.StringIO',
            'pyexcel.sheets.Reader',
            'pyexcel_io.BookWriter',
            'EasyDialogs',
            '_sysconfigdata_d',
            'pyexcel_io.BookReader',
            'pyexcel_io.SheetWriter',
            'pkgutil ',
            'unittest.loader ',
            'cl',
            'dis ',
            'pyexcel_io.BookReader',
            'org',
            'ordereddict',
            'pyexcel_io.DEFAULT_SHEETNAME',
            'pyexcel.ext.ods',
            'pyexcel_io.NamedContent',
            'unittest.main ',
            'pyexcel.sheets.ColumnSeriesReader',
            'pyexcel_io.BookWriter',
            'msvcrt',
            'pyexcel.io.StringIO',
            '__future__ ',
            'org',
            'dummy_threading ',
            'ordereddict',
            '_scproxy',
            'msvcrt',
            'pyexcel.sheets.load',
            'pyexcel.ext.xls',
            'pyexcel_io.NamedContent',
            'cl',
            'SOCKS',
            'pyexcel.sheets.load_from_records',
            'pyexcel_io.BookReader',
            '_emx_link',
            '_winreg',
            'gettext ',
            'pyexcel.io.load_file',
            'pyexcel.sheets.load_from_sql',
            '_winreg',
            'ordereddict',
            'SOCKS',
            '_compact '],
             hookspath=None,
             runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='keep',
          debug=False,
          strip=None,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=None,
               upx=True,
               name='keep')

有关修复导入问题的任何想法?看起来好像我在我的.spec文件中已经相当全面到了矫枉过正的程度。

0 个答案:

没有答案