导入spacy导致错误:ModuleNotFoundError:没有名为“ email.parser”的模块;电子邮件不是包裹

时间:2018-08-21 00:43:36

标签: python nlp python-import spacy

我在Windows 10上并使用pip安装spacy,但现在在运行时出现错误

import spacy

在python shell中。

我的错误消息是:

Traceback (most recent call last):
  File "C:\Users\Administrator\errbot-root\plugins\utility\model_training_test.py", line 17, in <module>
import spacy
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\spacy\__init__.py", line 4, in <module>
from .cli.info import info as cli_info
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\spacy\cli\__init__.py", line 1, in <module>
from .download import download
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\spacy\cli\download.py", line 5, in <module>
import requests
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\__init__.py", line 43, in <module>
import urllib3
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 71, in <module>
import email.parser
  File "C:\Users\Administrator\errbot-root\plugins\utility\email.py", line 1, in <module>
from errbot import BotPlugin, botcmd, arg_botcmd, webhook
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\errbot\__init__.py", line 12, in <module>
from .core_plugins.wsview import bottle_app, WebView
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\errbot\core_plugins\wsview.py", line 5, in <module>
from bottle import Bottle, request
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\bottle.py", line 38, in <module>
import base64, cgi, email.utils, functools, hmac, imp, itertools, mimetypes,\
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\cgi.py", line 39, in <module>
from email.parser import FeedParser
ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package

编辑:当尝试点子安装电子邮件时,出现以下错误:

Collecting email
Using cached https://files.pythonhosted.org/packages/71/e7/816030d3b0426c130040bd068be62b9213357ed02896f5d9badcf46d1b5
f/email-4.0.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\setuptools\__init__.py", lin
e 12, in <module>
    import setuptools.version
  File "c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\setuptools\version.py", line
1, in <module>
    import pkg_resources
  File 
"c:\users\administrator\appdata\local\programs\python\python36\lib\site-packages\pkg_resources\__init__.py",
line 36, in <module>
    import email.parser
  File "C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-install- 
p378w8he\email\email\parser.py", line 10, in <module>
    from cStringIO import StringIO
ModuleNotFoundError: No module named 'cStringIO'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in 
C:\Users\ADMINI~1\AppData\Local\Temp\2\pip-install-p378w8

他\电子邮件\

1 个答案:

答案 0 :(得分:1)

SpaCy已正确安装,只是有另一个名为email.py的文件正在干扰标准库电子邮件。不要使用标准库命名文件。