PyInstaller file fails to execute script - DistributionNotFound

后端 未结 5 1532
庸人自扰
庸人自扰 2020-12-10 18:22

I\'m trying to convert my python file to an executable using PyInstaller. The program uses the Google Cloud Translate API to translate given text between languages. When run

5条回答
  •  情歌与酒
    2020-12-10 18:49

    It is basically package building name issue. Pyinstaller tries to import

    google.cloud

    where Google cloud package is now called

    gcloud

    . So you need to create a hook file for that names

    C:\Users\\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\hooks\hook-gcloud.py

    File contents:

    from PyInstaller.utils.hooks import copy_metadata
    
    datas = copy_metadata('gcloud')
    

提交回复
热议问题