When I tried to create an executable file with PyInstaller for a program that uses Google Api (spreadsheet), I was able to compile it, but an error occurred at runtime. The compiled program looks like this
from googleapiclient.discovery import build #The following is omitted
pyinstaller --onefile main.py ./dist/main #Compiles successfully and an executable file is created
Now, when you execute the executable file,
pkg_resources.DistributionNotFound: The 'google-api-python-client' distribution was not found and is required by the application
Set the version of google-api-client to *** 1.8.0 ***. The point is to do the following:
pip install google-api-python-client==1.8.0
What a breakthrough solution! !! !! !!
For reference only, the execution environment is
When using google-could-vision or Firestore I saw an article about similar errors, but it wasn't very helpful. In each example, I encountered
pkg_resources.DistributionNotFound, so I thought I could go with the same solution, but I couldn't do it at all and the time melted.
After all, it was solved by issue discussion on github of google-api-client.
I tried cx_Freeze as an alternative to PyInstaller, but I couldn't do it after all.
I don't know how long this problem will occur (until PyInstaller / Google supports it?), And I don't know how long this method will solve it, so please use it as a reference.
I also wanted Python to establish a method to make it an official (cross-platform) executable file like Golang.