运行后保存Python smtplib错误.pyc

时间:2012-02-06 20:40:30

标签: python

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会保存到文件目录中并且会出现此错误。

1 个答案:

答案 0 :(得分:2)

不要将文件命名为email.py,这会导致问题。