This question already has answers here:
How do I download NLTK data?

(15 个回答)


5 个月前关闭。




我正在尝试下载整个教科书,但它只是显示内核繁忙。我离开了半小时,但仍然显示忙碌状态。当我停止它时,出现了以下错误。任何人都可以指导我如何解决问题,还是我没有正确遵循这些步骤。
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-3-fec50ed38a60> in <module>()
      1 import nltk
----> 2 nltk.download()

C:\Users\\Anaconda2\lib\site-packages\nltk\downloader.pyc in download(self, info_or_id, download_dir, quiet, force, prefix, halt_on_error, raise_on_error)
    659             # function should make a new copy of self to use?
    660             if download_dir is not None: self._download_dir = download_dir
--> 661             self._interactive_download()
    662             return True
    663

C:\Users\\Anaconda2\lib\site-packages\nltk\downloader.pyc in _interactive_download(self)
    980         if TKINTER:
    981             try:
--> 982                 DownloaderGUI(self).mainloop()
    983             except TclError:
    984                 DownloaderShell(self).run()

C:\Users\\Anaconda2\lib\site-packages\nltk\downloader.pyc in mainloop(self, *args, **kwargs)
   1715
   1716     def mainloop(self, *args, **kwargs):
-> 1717         self.top.mainloop(*args, **kwargs)
   1718
   1719     #/////////////////////////////////////////////////////////////////

C:\Users\\Anaconda2\lib\lib-tk\Tkinter.pyc in mainloop(self, n)
   1127     def mainloop(self, n=0):
   1128         """Call the mainloop of Tk."""
-> 1129         self.tk.mainloop(n)
   1130     def quit(self):
   1131         """Quit the Tcl interpreter. All widgets will be destroyed."""

KeyboardInterrupt:

jupiter notebook 中使用的命令
import nltk
nltk.download()

最佳答案

我会尝试逐个下载您需要的内容。我实际上遇到了这个问题,我使用 nltk.download('name of resource') 解决了它

关于python - 无法在 Jupyter 笔记本中下载 nltk.download(),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53671197/

10-12 21:55