简体   繁体   English

ImportError:在python 2.7上没有名为enum的模块

[英]ImportError: No module named enum on python 2.7

I'm running a code with Python 2.7. 我正在用Python 2.7运行代码。 And I get "ImportError: No module named enum". 我得到“ ImportError:没有名为枚举的模块”。 I installed enum with "pip install enum" but the error keeps coming. 我使用“ pip install enum”安装了枚举,但错误不断出现。 What shall I do?? 我该怎么办??

You want the backport : 您需要反向移植

pip install enum34

The distribution named enum on PyPI is something else, unfortunately. 不幸的是,在PyPI上名为enum的发行版还有别的。

The enum module is part of Python 3.4 (and later) stdlib but not part of Python 2.7 stdlib. enum模块是Python 3.4(及更高版本)stdlib的一部分,但不是 Python 2.7 stdlib的一部分。

Fortunately, there's an available backport suitable to Python 2.7. 幸运的是,有一个适用于Python 2.7的可用反向端口。 Install it and play with it. 安装并使用它。

https://pypi.python.org/pypi/enum34 https://pypi.python.org/pypi/enum34

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM