ImportError: No module named datetime ImportError: No module named datetime python python

ImportError: No module named datetime


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.


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


I tried to re-install it by these steps.

1. remove the old version of venv2. virtualenv venv3. .venv/activate/bin4. pip install -r requirements/ requirements.txt

And it works perfectly. Thanks guys :)