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


最近在给python程序打包,需要用到pyinstaller 包,安装好之后在给程序打包的时候出现错误,虽然程序已经打包,但是打包好的程序并不能够正确执行!!!


一、错误原因

错误如下:
在这里插入图片描述

这是因为您enum不是标准的库enum模块。您可能已enum34安装该软件包。
检查是否属于这种情况的一种方法是检查财产 enum.file

import enum
print(enum.__file__)  
# standard library location should be something like 
# /usr/local/lib/python3.6/enum.py

二、解决错误方法:参考

从python 3.6开始,enum34库不再与标准库兼容。该库也是不必要的,因此您只需卸载它即可。
我安装的python版本是3.6.5版本的,所有直接卸载enum库即可
在这里插入图片描述
卸载enum34库

pip uninstall enum34

卸载之后,问题解决,大功告成!!!

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述
♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠

已标记关键词 清除标记
<div><p>Getting below error while installing kiteconnect==3.8.2 in AWS Elastic Beanstalk in python 3.6.</p> <p>Building wheels for collected packages: kiteconnect, retrying Building wheel for kiteconnect (setup.py): started Building wheel for kiteconnect (setup.py): finished with status 'done' WARNING: Legacy build of wheel for 'kiteconnect' created no files. Command arguments: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; <strong>file</strong>='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(<strong>file</strong>);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, <strong>file</strong>, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-41ix1k84 Command output: [use --verbose to show] Running setup.py clean for kiteconnect Building wheel for retrying (setup.py): started Building wheel for retrying (setup.py): finished with status 'done' Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=9532 sha256=6c3392994eb699dc99d81e801b0d28ba498b145a267b70028f0780130756ff5c Stored in directory: /root/.cache/pip/wheels/ac/cb/8a/b27bf6323e2f4c462dcbf77d70b7c5e7868a7fbe12871770cf Successfully built retrying Failed to build kiteconnect</p> <p>Running setup.py install for kiteconnect: started Running setup.py install for kiteconnect: finished with status 'error' ERROR: Command errored out with exit status 1: command: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; <strong>file</strong>='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(<strong>file</strong>);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, <strong>file</strong>, '"'"'exec'"'"'))' install --record /tmp/pip-record-pziu6m7_/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect cwd: /tmp/pip-install-xxzkrm1h/kiteconnect/ Complete output (9 lines): Traceback (most recent call last): File "", line 1, in File "/opt/python/run/venv/local/lib/python3.6/site-packages/setuptools/<strong>init</strong>.py", line 3, in from fnmatch import fnmatchcase File "/opt/python/run/venv/lib64/python3.6/fnmatch.py", line 14, in import re File "/opt/python/run/venv/lib64/python3.6/re.py", line 142, in class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag' ---------------------------------------- ERROR: Command errored out with exit status 1: /opt/python/run/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"'; <strong>file</strong>='"'"'/tmp/pip-install-xxzkrm1h/kiteconnect/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(<strong>file</strong>);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, <strong>file</strong>, '"'"'exec'"'"'))' install --record /tmp/pip-record-pziu6m7_/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/kiteconnect Check the logs for full command output. 2020-09-19 10:05:10,776 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 Traceback (most recent call last):</p> <p>该提问来源于开源项目:zerodha/pykiteconnect</p></div>
©️2020 CSDN 皮肤主题: 博客之星2020 设计师:CY__0809 返回首页