我正在尝试绘制文本文件中前50个单词的频率图,但这是我得到的错误消息。
s-10', 'logan', 'jacksonville', 'brokerage', 'brickman', 'mount', 'wireless', 'p
hillips', 'advisor', 'okavango', 'portfolio', 'sill', 'weddings', 'share', 'para
legal']
>>> fdist1.plot(50)
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\nltk\probability.py", line 229, in plot
import pylab
ImportError: No module named 'pylab'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\nltk\probability.py", line 231, in plot
raise ValueError('The plot function requires the matplotlib package (aka pyl
ab). '
ValueError: The plot function requires the matplotlib package (aka pylab). See h
ttp://matplotlib.sourceforge.net/我的教授的示例代码没有提到任何关于导入pylab包的内容。我试着下载它,但它似乎仍然不能工作。
感谢您的帮助:)谢谢
发布于 2016-01-18 17:47:30
绘制分布需要matplotlib。
请参阅FreqDist.plot()的相关行
try:
from matplotlib import pylab
except ImportError:
raise ValueError('The plot function requires matplotlib to be installed.'
'See http://matplotlib.org/')https://stackoverflow.com/questions/26395478
复制相似问题