未找到挂钩目录

时间:2017-05-20 14:01:35

标签: python hook pyinstaller matplotlib-basemap

我尝试使用Pyinstaller创建.exe。我需要包含一个名为hook-mpl_toolkits.basemap的钩子。我在.spec文件中添加了钩子,如下所示:

# -*- mode: python -*-

block_cipher = None

a = Analysis(['xxx.py'],
             pathex=['C:\\...\\...\\xxx'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=['C:\\...\\...\\hooks\\hook-mpl_toolkits.basemap.py'],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='map',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='map')

但是当我运行" Pyinstaller xxx.spec"时,我收到错误:

  

找不到挂钩目录

安建议?

1 个答案:

答案 0 :(得分:1)

hookspath是路径,而不是文件。它需要是:

hookspath=['C:\\...\\...\\hooks'],

选择钩子本身以匹配python模块的名称,所以这种情况:

mpl_toolkits.basemap