无法在Python 3.8中安装电子邮件模块

时间:2019-12-10 21:51:21

标签: python

我在Windows 10上使用Python 3.8和pip 19.3.1,当我尝试pip install email时出现错误:

    ERROR: Command errored out with exit status 1:
     command: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-8nsypvg1\\email\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-8nsypvg1\\email\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\User\AppData\Local\Temp\pip-install-8nsypvg1\email\pip-egg-info'
         cwd: C:\Users\User\AppData\Local\Temp\pip-install-8nsypvg1\email\
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\__init__.py", line 18, in <module>
        import setuptools.version
      File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\version.py", line 1, in <module>
        import pkg_resources
      File "c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py", line 36, in <module>
        import email.parser
      File "C:\Users\User\AppData\Local\Temp\pip-install-8nsypvg1\email\email\parser.py", line 10, in <module>
        from cStringIO import StringIO
    ModuleNotFoundError: No module named 'cStringIO'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

如何安装此模块?

2 个答案:

答案 0 :(得分:3)

email模块是为python 2.3和2.4分发的。从2.5开始,它已包含在标准python发行版中。您正在寻找https://docs.python.org/3/library/email.html

答案 1 :(得分:0)

模块“电子邮件”已被弃用,不再更新。它的最新更新时间为2011年7月19日。当时python的最新版本为Python 2.7

因此,它不支持Python 3.8。您可以做的就是在Python 2.7中安装它

使用以下命令在Python 2.7中安装6.0.0版

pip install email==6.0.0a1