ImportError: No module named datetime

Just run this command. It worked like a charm!

$ cp /usr/bin/python2.7 $(which python2.7)

This just happened to me after the 14.10 update, and it seems to be because my virtual environments have old copies of /usr/bin/python2.7 that — unlike the new binary — do not include datetime built-in, and so get an error when they cannot find it on disk anywhere. The new interpreter seems to import it without any file I/O (try running it under strace to check).

More info here


This happened to me when I created a virtualenv and then upgraded from 12.04 to 14.04.

I had to delete my virtualenv and recreate it, and after doing that, everything worked again.