2017-02-27 51 views
0

谷歌的BigQuery蟒蛇的lib我有開始如下Python腳本:包括pyinstaller

from google.cloud import bigquery 

這個包安裝有:

pip install google-cloud-bigquery --upgrade 

林的印象是pyinstaller應該找到所有的所需的軟件包並安裝它們,但是當我在Windows上運行創建的.exe或在Mac上運行時,我收到錯誤消息:

pkg_resources.DistributionNotFound: The 'google-cloud-core' distribution was not found and is required by the application 

這是我的.spec文件,請告訴我在哪裏可以放google-cloud-core,以便安裝正確的軟件包。

# -*- mode: python -*- 

block_cipher = None 


a = Analysis(['tests.py'], 
     pathex=['/Users/daniellee/Development/alice-connectors/aconn'], 
     binaries=[], 
     datas=[], 
     hiddenimports=[], 
     hookspath=[], 
     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, 
     a.binaries, 
     a.zipfiles, 
     a.datas, 
     name='tests', 
     debug=False, 
     strip=False, 
     upx=True, 
     console=True) 

在此先感謝。

回答

0

所以這就是我得到它的工作。

使用鉤子文件,命名爲hook-google.cloud.bigquery包含:

from PyInstaller.utils.hooks import copy_metadata 

datas = copy_metadata('google-cloud-bigquery') 
datas += copy_metadata('google-cloud-core') 

然後將路徑添加到這個鉤子文件到您的.spec文件。

... 
hookspath=['/Users/joesoap/Development/project/hooks'] 
... 

希望這可以幫助別人。