pyinstaller:AttributeError:模块“枚举”没有属性“IntFlag”[重复]
Posted
技术标签:
【中文标题】pyinstaller:AttributeError:模块“枚举”没有属性“IntFlag”[重复]【英文标题】:pyinstaller : AttributeError: module 'enum' has no attribute 'IntFlag' [duplicate] 【发布时间】:2018-01-04 08:25:55 【问题描述】:我用pyqt4做了一个程序。我试图通过 pyinstaller 创建一个可执行文件。但我失败了,我继续寻找原因。 最后发现pyinstaller不支持pyqt4。于是我安装了pyqt5,把代码改成了pyqt5。 然而,pyinstaller 仍然会导致错误并在一定程度上解决了问题。我什至删除了pyqt4。 但是我仍然没有解决下面的问题。
AttributeError:模块“枚举”没有属性“IntFlag”
而且是引用
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
谢谢~
【问题讨论】:
【参考方案1】:我有类似的问题,我只是按照以下说明解决了问题:Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?
pip uninstall enum34
【讨论】:
【参考方案2】:我试过pip uninstall enum
,它对我不起作用。我使用 conda 并且还有其他依赖项。
我实际上创建了一个新的虚拟环境,其中只有我需要的包(及其依赖项)。然后我在那里由安装程序安装。有效。这是在 Windows 上的。
【讨论】:
以上是关于pyinstaller:AttributeError:模块“枚举”没有属性“IntFlag”[重复]的主要内容,如果未能解决你的问题,请参考以下文章