import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import encoders
import os
Traceback (most recent call last):
File "C:\Users\user Account\Desktop\email.py", line 1, in <module>
import smtplib
File "C:\Python27\lib\smtplib.py", line 46, in <module>
import email.utils
File "C:\Users\user Account\Desktop\email.py", line 2, in <module>
from email.MIMEMultipart import MIMEMultipart
ImportError: No module named MIMEMultipart
为什么会这样?当我通过python sell导入smtplib时,我没有问题!
第二个副本.pyc会保存到文件目录中并且会出现此错误。
答案 0 :(得分:2)
不要将文件命名为email.py
,这会导致问题。