美文网首页
18、pyinstaller的用法和出错积累

18、pyinstaller的用法和出错积累

作者: 梦捷者 | 来源:发表于2020-04-14 20:36 被阅读0次

1、python用pyinstaller生成exe时报错 TypeError: an integer is required (got type bytes)

2、ImportError: DLL load failed: 找不到指定的模块(在pyinstaller中打包进行运行时的文件)

3、pyinstaller的相关用法的总结

4、在pyinstaller中出现没有.dll结尾的文件的时候,进行配置**.spec中的参数

当报相应.dll文件报错的时候,对datas参数进行相应文件的配置,如果有些文件不是直接引用的话,那就将hiddenimports里面的参数进行配置,目的是使这些文件夹下面的模块可以进行直接的调用。

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['main.py'],
             pathex=['D:\\pycharmspace\\HPSS_SDC_TOOL\\src'],
             binaries=[],
              datas=[
                ('./config/*.json', 'config'),
                ('./db/*.dll', 'db')
             ],
             hiddenimports=[
                'workers.hpss_online_model',
                'workers.hpss_proxy_clock',
                'workers.hpss_proxy_robot',
                'workers.hpss_webapi',
        'workers.hpss_report',
        'workers.hpss_cache_manager',
        'tasks.task_test',
        'tasks.task_scada_migrated'
             ],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='main',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               upx_exclude=[],
               name='main')

相关文章

网友评论

      本文标题:18、pyinstaller的用法和出错积累

      本文链接:https://www.haomeiwen.com/subject/ohoroctx.html