Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
¿Por qué Python 3.6.1 arroja AttributeError: el módulo 'enum' no tiene el atributo 'IntFlag'?

Acabo de instalar Python 3.6.1 para MacOS X

Cuando intento ejecutar la consola (o ejecutar cualquier cosa con Python3), aparece este error:

 AttributeError: module 'enum' has no attribute 'IntFlag' $ /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 Failed to import the site module Traceback (most recent call last): File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 544, in <module> main() File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 530, in main known_paths = addusersitepackages(known_paths) File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 282, in addusersitepackages user_site = getusersitepackages() File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 258, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 248, in getuserbase USER_BASE = get_config_var('userbase') File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 601, in get_config_var return get_config_vars().get(name) File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 580, in get_config_vars import _osx_support File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_osx_support.py", line 4, in <module> import re File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 142, in <module> class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag'

La clase IntFlag existe dentro de enum.py. Entonces, ¿por qué se lanza el AttributeError?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Es porque su enum no es el módulo de enum de biblioteca estándar. Probablemente tenga instalado el paquete enum34 .

Una forma de verificar si este es el caso es inspeccionar la propiedad enum.__file__

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

Desde Python 3.6, la biblioteca enum34 ya no es compatible con la biblioteca estándar. La biblioteca tampoco es necesaria, por lo que simplemente puede desinstalarla.

 pip uninstall -y enum34

Si necesita que el código se ejecute en versiones de python <= 3.4 y > 3.4, puede intentar tener enum-compat como requisito. Solo instala enum34 para versiones anteriores de python sin la enumeración de biblioteca estándar.

over 4 years ago · Santiago Trujillo Report

0

No estoy seguro de si todavía tienes este problema. Tuve un problema similar y pude resolverlo simplemente desactivando PYTHONPATH

$ unset PYTHONPATH

over 4 years ago · Santiago Trujillo Report

0

Para mí, este error ocurrió después de instalar el componente gcloud app-engine-python para integrarlo en pycharm. La desinstalación del módulo ayudó, incluso si pycharm ahora no se está cargando en el motor de la aplicación.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!