【发布时间】:2021-07-05 14:59:05
【问题描述】:
import random
import matplotlib.pyplot as plt
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
freq = {c: random.randint(1, 100) for c in alphabet if random.randint(1, 10) > 2}
print(len(freq))
print(freq)
plt.bar(range(len(freq)), freq.values(), align='center')
plt.xticks(range(len(freq)), freq.keys())
plt.show()
我收到了一个使用 matplotlib 的代码,我已经在控制台中(在 Git Bash 中)安装了它,如 here 并在设置 - 模块下搜索了 matplotlib,但只找到了另外两个并安装了它们(别名导入/python 中的实时编码) )。我还是变成了这个错误:
ModuleNotFoundError: No module named 'matplotlib'
【问题讨论】:
-
在你的pycharm输出控制台,你可以看到python的位置(
C:\some\path\Scripts\python.exe),现在,运行the python.full.path.exe -m pip install matplotlib -
@LeiYang 我说,我已经做到了。
-
当我尝试您的建议时,我看到:“要求已经满足”
-
你没有做,我保证。
-
@LeiYang 我试过了,没用
标签: python matplotlib import module