54

I changed from Win XP 32bit to Win7 64bit and reinstalled Python 2.7 and the Anaconda package.

However, it seems like it isn't properly installed. When I do

import enum 

There is the error:

ImportError: No module named enum

However, when I try import pandas it works.

When typing help() and modules within Ipython nothing happens.

Any idea how to go from here?

user
  • 1,220
  • 1
  • 12
  • 31
user3276418
  • 1,777
  • 4
  • 20
  • 29
  • when you said you reinstalled Python, is it an uninstall and then reinstall or is it an overwrite on what you had already? Also, did you reinstall using 64-bit Python or 32-bit? Chances are that you might have messed up your library settings. You should do fully clean uninstall, delete all temporary directories (if any), and then reinstall Python 2.7 (64-bit) to see if things look different. – ha9u63a7 Nov 09 '14 at 12:37
  • 1
    I had winXp on my machine and python installed in the program folder. I added another partition and installed Win7 64bit on it. On this partition I installed Python without uninstalling it at the WinXP partition. Can this yield to messed up libraries? Should I uninstall Python on both partitions before reinstalling on Win7? Where to look for temporary directories that should be deleted? – user3276418 Nov 10 '14 at 09:24
  • Try `import sys`, then `print(sys.path)` to see where your python libraries are read from. Maybe you'll find the problem this way... – jkalden Nov 10 '14 at 09:48
  • Everything points to C:\\Program Files\\Anaconda, which is the WIn7 partition. There is another path: 'C:\\Users\\hotz\\.ipython' that also points to the Win7 partition. Another path points to the directory where my personal scripts are stored. Everything here looks normal to me. – user3276418 Nov 10 '14 at 16:36

8 Answers8

76

Or run a pip install --upgrade pip enum34

Dark Star1
  • 6,986
  • 16
  • 73
  • 121
42

I ran into this same issue trying to install the dbf package in Python 2.7. The problem is that the enum package wasn't added to Python until version 3.4.

It has been backported to versions 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4, you just need the package from here: https://pypi.python.org/pypi/enum34#downloads

Jonathan Kunze
  • 439
  • 3
  • 5
5

I ran into this issue with Python 3.6 and Python 3.7. The top answer (running pip install --upgrade pip enum34) did not solve the problem.


I don't know why, but the reason why this error happen is because enum.py was missing from .venv/myvenv/lib/python3.7/.

But the file was in /usr/lib/python3.7/.

Following this answer, I just created the symbolic link by myself :

ln -s /usr/lib/python3.7/enum.py .venv/myvenv/lib/python3.7/enum.py
Astariul
  • 2,190
  • 4
  • 24
  • 41
2

Please use --user at end of this, it is working fine for me.

pip install enum34 --user
Riti verma
  • 21
  • 3
1

On Windows 10 64:

Use pip install --upgrade pip enum34 as DarkStar1 says. And if you have an error like just enter :

python.exe -m pip install --upgrade pip enum34
0

soved renaming file from 'enum.py(same name of import)' to 'myEnum(or anything else)'

0

As jonathan-kunze says you have to download the package from https://pypi.org/project/enum34/#downloads but then he doesn't say how to install it as john rightfully stated.

I have lost few hours to found how to do it and I almost found it by luck as I haven't seen ressources online explaining how to do it, only how to install with pip or other automatic methods.

The thing is that you have to copy the enum folder inside the packages at the /lib (or /Lib) folder of the python of your choice. For example at /usr/lib/python2.7/ for python 2.7

Then you will be able to import enum

neozero
  • 31
  • 2
-11

Depending on your rights, you need sudo at beginning.

  • 1
    instead of `sudo` at the beginning, `--user` at the end solves the same problem in a much more reponsible way – craq Sep 17 '18 at 00:31