Import error for a module that reports error reports

I am trying to run a script using backport Enumfor python 2.7.8 via Cygwin.

When the script is executed, it throws a general error Import Error: No module named Enum.

  • pip-2.7 install enum34 says it is already installed
  • pip-2.7 install enum34 --upgrade gave the same error
  • python --version shows 2.7.8
  • pip freeze shows enum=1.0.4
  • pip uninstall enum34 / pip install enum34 made no difference.

What can I try next?

+4
source share
2 answers

This is a bit confusing, but you need to import from enum, not enum34:

Here is an example from the docs :

from enum import Enum
class Color(Enum):
    red = 1
    green = 2
    blue = 3
+1
source

, , import Enum E. "e": import Enum

0

All Articles