Cannot create .exe file with pyinstaller

Viewed 532

Language: python 3.7.4

While I am trying to convert my python file into exe file with pyinstaller, it does not work well.

When I run the following command in the same directory as the python file is saved,

pyinstaller test.py --noconsole --onefile

the following error message appears in the console and get no ".exe" file.

PyInstaller.exceptions.ImportErrorWhenRunningHook: Failed to import module __PyInstaller_hooks_0_pydoc required by hook for module C:\Users\user\Anaconda3\lib\site-packages\PyInstaller\hooks\hook-pydoc.py. Please check whether module __PyInstaller_hooks_0_pydoc actually exists and whether the hook is compatible with your version of C:\Users\hiro\Anaconda3\lib\site-packages\PyInstaller\hooks\hook-pydoc.py: You might want to read more about hooks in the manual and provide a pull-request to improve PyInstaller.
  1. I checked the "hook-pydoc.py" file but no description about the hook version.
  2. I cannot find "__PyInstaller_hooks_0_pydoc" module

Anyone have some help for this problem?

Or, as the last phrase of the error message says,

You might want to read more about hooks in the manual and provide a pull-request to improve PyInstaller.

Pyinstaller have some problem?

If more information needed, I will add. Thank you.

1 Answers

The error occurred when your main file calls files on other directories.

For e.g :- test.py uses db.py in DB folder.

Try to execute command with '-D' flag.

pyinstaller -D --noconsole test.py
Related