【发布时间】:2022-01-24 16:11:42
【问题描述】:
我似乎不知道如何在 Windows 上安装 Matplotlib for Python 3.9。这些是我在命令提示符中输入的命令,但没有一个起作用。
$ python -m pip install --user matplotlib
$ python3 -m pip install --user matplotlib
python3 -m pip install matplotlib --pre --user
py -m pip install -U matplotlib --user
前两个给出这个错误信息:
'$' is not recognized as an internal or external command,
operable program or batch file.
第二个给出这个错误信息:
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
第三个似乎已经下载了所有内容,但是当我尝试在 Python 中运行 Matplotlib 时,它给了我这个错误消息:
Traceback (most recent call last):
File "C:\Users\costr\AppData\Local\Programs\Python\Python39\temporary.py", line 1, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
这是我要运行的代码:
import matplotlib.pyplot as plt
squares=[1, 4, 9, 16, 25]
fig, ax=plt.subplots()
ax.plot(squares)
plt.show()
【问题讨论】:
标签: python matplotlib