2017-05-20 97 views
1

我嘗試使用Pyinstaller創建.exe。我需要包含一個名爲hook-mpl_toolkits.basemap的鉤子。我加了鉤在.spec文件如下:未找到Hook目錄

# -*- 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」,我收到一個錯誤:

Hook directory not found

安建議?

回答

1

hookspath是一個路徑,而不是文件。這將需要:

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

自己,要選擇符合蟒蛇模塊的名字掛鉤,所以這種情況下:

mpl_toolkits.basemap