python - Error when importing matplotlib.pyplot
欧阳克
欧阳克 2017-06-12 09:20:07
0
3
1182

今天在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

欧阳克
欧阳克

温故而知新,可以为师矣。 博客:www.ouyangke.com

reply all(3)
黄舟

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

phpcn_u1582

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!