【问题标题】:How to Install Matplotlib for Python 3.9 in Windows?如何在 Windows 中为 Python 3.9 安装 Matplotlib?
【发布时间】: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


    【解决方案1】:

    很抱歉,如果这没有太大帮助,但不应该 pip install matplotlib 要么 python -m pip install --user matplotlib(不带$的拳头命令) 工作吗?

    您也可以使用pip freeze检查模块是否安装。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-15
      • 2022-10-06
      • 1970-01-01
      • 2021-02-07
      • 2021-03-21
      • 2021-02-07
      • 1970-01-01
      • 2021-05-08
      相关资源
      最近更新 更多