PyInstaller file fails to execute script - DistributionNotFound

后端 未结 5 1543
庸人自扰
庸人自扰 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条回答
  •  猫巷女王i
    2020-12-10 18:53

    I had the exact same issue. I solved it by doing this:

    1. Goto the Pyinstaller hooks folder (~\Lib\site-packages\PyInstaller\hooks)
    2. Find the file hook-google.cloud.py, open it, and add the following code to it
    datas += copy_metadata('google-cloud-translate')
    datas += copy_metadata('google-api-core')
    

    The issue seems to be that get_distribution is not working with the default google.cloud.translate hook, so I just added this to a hook that was working.

    Hope this helps someone.

提交回复
热议问题