python-3.x 导入matplotlib.pyplot作为plt

ltskdhd1  于 2022-12-05  发布在  Python
关注(0)|答案(3)|浏览(122)

我有python 3.2.3在windows上。安装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

有什么想法吗?

e37o9pze

e37o9pze1#

您需要安装urllib。这是matplotlib所必需的

brc7rcf0

brc7rcf02#

安装Python 3.10并更新pip,然后尝试安装Matplotlib并使用pip install urllib安装urllib

ovfsdjhp

ovfsdjhp3#

Look Install urllib from : https://pypi.python.org/pypi/urllib2_file/0.2.1
Or if you was instaled pip you can use sudo pip install urllib

相关问题