简体   繁体   中英

Getting ModuleNotFound errors in python

Traceback (most recent call last):
  File "forwardSpam.py", line 5, in <module>
    from email.Header import Header
ModuleNotFoundError: No module named 'email.Header'

Traceback (most recent call last):
  File "forwardSpam.py", line 6, in <module>
    from email.mime.text import MIMEText
ModuleNotFoundError: No module named 'email.mime.text'

These are the errors that I get when trying to use this script off github

I guess you haven't dowloaded the module. If you're using pycharm Preferences > Projects > Python Interpreter > Find the email module and add that.

Or you can just pip install the module from your terminal which is

   pip install email

(but if you're using different ide you need to look where you can add modules) that way you downloaded the module for calling in the script that you wrote.

I think that should do the work.

And also from email.Header import Header You can just say

 from email import Header

or any other callable specific function after installing the module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM