python - Pyinstaller:AttributeError:模块“枚举”没有属性“IntFlag”
问题描述
我需要将python代码编译为exe。我找到了一些指导如何做到这一点,我被要求为此安装 PyInstaller:
pip install --upgrade pyinstaller
但我得到下一个错误:
C:\Users\alonat>pip install pyinstaller
Collecting pyinstaller
Using cached PyInstaller-3.6.tar.gz (3.5 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\alonat\appdata\local\programs\python\python37-32\python.exe' 'c:\users\alonat\appdata\local\programs\python\python37-32\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\alonat\AppData\Local\Temp\pip-build-env-yo59g2oq\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
cwd: None
Complete output (14 lines):
Traceback (most recent call last):
File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\site-packages\pip\__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\cli\main.py", line 5, in <module>
import locale
File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\locale.py", line 16, in <module>
import re
File "c:\users\alonat\appdata\local\programs\python\python37-32\lib\re.py", line 143, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\alonat\appdata\local\programs\python\python37-32\python.exe' 'c:\users\alonat\appdata\local\programs\python\python37-32\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\alonat\AppData\Local\Temp\pip-build-env-yo59g2oq\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel Check the logs for full command output.
你知道如何解决这个错误吗?
解决方案
如果已安装,请卸载 enum34 模块,然后重试。
pip uninstall enum34
这将解决错误,如果您需要 enum34 将其降级为 enum34==1.1.8
此处有用的信息 为什么 Python 3.6.1 会抛出 AttributeError:模块 'enum' 没有属性 'IntFlag'? https://github.com/iterative/dvc/issues/1995
推荐阅读
- python - MacBook Pro m1 python pyxel 库
- gdb - 是否可以在 x86 机器中加载核心文件(由 arm 处理器生成)?
- ios - 在 Xcode for iOS 上构建时 firebase 出错
- flutter - Flutter:如何 Widget 测试 使用 Widget 测试共享包
- python - 为什么我不能更改我的 SSH 隧道的本地绑定地址?
- postgresql - 您将如何更改部署到 kubernetes 的 Postgres 容器的文件/目录所有权?
- json - 有没有办法从 CloudFormation 模板填充 Amazon DynamoDB 表?
- twilio - twilio 接收文本基本身份验证
- python - 扫描所有连接到特定 WIFI 的客户端
- python - 如何将 yaml 字符串插入到 yaml 值中,就好像它是 yaml