今天在import matplotlib.pyplot时报错:
Traceback (most recent call last):
File "C:UserslenovoDesktopzq.py", line 5, in <module>
import matplotlib.pyplot
File "C:Python34libsite-packagesmatplotlib__init__.py", line 129, in <module>
from six.moves.urllib.request import urlopen
File "C:Python34libsite-packagessix.py", line 92, in get
result = self._resolve()
File "C:Python34libsite-packagessix.py", line 160, in _resolve
module = _import_module(self.mod)
File "C:Python34libsite-packagessix.py", line 82, in _import_module
__import__(name)
File "C:Python34liburllibrequest.py", line 88, in <module>
import http.client
File "C:Python34libhttpclient.py", line 69, in <module>
import email.parser
File "C:Python34libemailparser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:Python34libemailfeedparser.py", line 27, in <module>
from email import message
File "C:Python34libemailmessage.py", line 10, in <module>
import uu
File "C:UserslenovoDesktopuu.py", line 4, in <module>
import requests
File "C:Python34libsite-packagesrequests-2.9.1-py3.4.eggrequests__init__.py", line 58, in <module>
from . import utils
File "C:Python34libsite-packagesrequests-2.9.1-py3.4.eggrequestsutils.py", line 12, in <module>
import cgi
File "C:Python34libcgi.py", line 39, in <module>
from email.parser import FeedParser
ImportError: cannot import name 'FeedParser'
我只是一个多月没用matplotlib模块,以前都是好好的,以前写的有用matplotlib模块的东西现在都报错,这是要重装吗?
我刚在stackoverflow.com中找到一个相似的问题:https://stackoverflow.com/que...,因为不懂英文,用google翻译好像原因是在同一文件夹中有一个同名脚本,但我看得不太明白,请大家帮助,谢谢
还有就是这几天每次运行脚本的时候都会自动生成一个__pycache__文件夹,里面有个xxxx.cpython-34.pyc
I found it. It turns out there is a file called uu.py which may have the same name. Thank you everyone
Check whether there is a py file in your current directory with the same name as the related library name
Error reason:
from email.parser import FeedParser
ImportError: cannot import name 'FeedParser'
FeedParser is available in the python3 environment, but yours is not. The possible reason is: there is an email.py file or email directory in the current directory