ImportError: No module named 'email.mime'; email is not a package
I encountered the same problem just now. Finally, I found it's because I name the python file as 'email.py'. It works after changing its name.
The issue is in pip. I was unable to update setuptools using
easy_install --upgrade setuptools
I was also unable to install email with pip using
pip install email
I fixed the problem by installing email using easy_install
easy_install email
Hope someone finds that as helpful. Thanks to those who have helped.
I had the same problem. Both answers helped me solve it. However, in addition I also had to delete the email.pyc file that was created when the script was run with the old name email.py.
To summarize:
- make sure the email module is installed
- delete the email.pyc file that was created when the script called email.py was run
- rename the script to something else
Don't use "email" in your .py file name or even in package name as well. This will cause confusion to the interpreter between user declared module and pre-defined modules