Search code examples
pythonpyqt4pyqt5pyinstaller

pyinstaller : AttributeError: module 'enum' has no attribute 'IntFlag'


I made a program using pyqt4. I tried to create an executable file through pyinstaller. But I failed and I continued to search for the reason. Finally, I found that the pyinstaller does not support pyqt4. So I installed pyqt5 and changed the code to pyqt5. The pyinstaller, however, still caused errors and to some extent solved the problem. I even erased pyqt4. But I still have not solved the problem below.

AttributeError: module 'enum' has no attribute 'IntFlag'

And it is trackback

Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'sip'
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.4.dev0+ab8fd9753', 'console_scripts', 'pyinstaller')()
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\__main__.py", line 94, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
    exec(text, spec_namespace)
  File "<string>", line 16, in <module>
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\building\build_main.py", line 213, in __init__
    self.__postinit__()
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
    self.assemble()
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\building\build_main.py", line 472, in assemble
    module_hook.post_graph()
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
    self._load_hook_module()
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
    self.hook_module_name, self.hook_filename)
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\compat.py", line 744, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\hooks\hook-PyQt5.QtCore.py", line 15, in <module>
    binaries = qt_plugins_binaries('codecs', namespace='PyQt5')
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 65, in qt_plugins_binaries
    pdir = qt_plugins_dir(namespace=namespace)
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 39, in qt_plugins_dir
    raise Exception('Cannot find {0} plugin directories'.format(namespace))
Exception: Cannot find PyQt5 plugin directories

Thank you~


Solution

  • I have a similar problem and I just solved the problem by following this instruction:
    Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?

    pip uninstall enum34