将matplotlib.pyplot导入为plt

时间:2014-04-29 16:52:37

标签: python python-3.x matplotlib

我在Windows上有python 3.2.3。 安装了matplotlib

我试图这样做:

import matplotlib.pyplot as plt

我明白了:

Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
import matplotlib.pyplot as plt
File "E:\programs\python 3.2.3\lib\site-packages\matplotlib\pyplot.py", line 24, in <module>
import matplotlib.colorbar
File "E:\programs\python 3.2.3\lib\site-packages\matplotlib\colorbar.py", line 29, in <module>
import matplotlib.collections as collections
File "E:\programs\python 3.2.3\lib\site-packages\matplotlib\collections.py", line 23, in <module>
import matplotlib.backend_bases as backend_bases
File "E:\programs\python 3.2.3\lib\site-packages\matplotlib\backend_bases.py", line 50, in <module>
import matplotlib.textpath as textpath
File "E:\programs\python 3.2.3\lib\site-packages\matplotlib\textpath.py", line 5, in <module>
import urllib.request, urllib.parse, urllib.error
ImportError: No module named urllib.request

任何想法?

2 个答案:

答案 0 :(得分:0)

您需要安装urllib。 这是matplotlib

所必需的

答案 1 :(得分:-1)

https://pypi.python.org/pypi/urllib2_file/0.2.1

查看安装urllib

如果您已安装pip,则可以使用sudo pip install urllib