简体   繁体   English

无法在Juypter笔记本中导入nltk模块?

[英]Can't import nltk module in Juypter notebook?

I have tried importing nltk module using notebook (Juypter) but its keep showing the error. 我尝试使用notebook(Juypter)导入nltk模块,但它一直显示错误。

ImportError                               Traceback (most recent call last)
<ipython-input-1-b06499430ee0> in <module>()
----> 1 import nltk

ImportError: No module named nltk.   

I have looked at the various solutions. 我看过各种解决方案。 I am able to import the module with the terminal but not in the notebook. 我可以使用终端导入模块,但不能在笔记本中导入。

Open a command prompt and write: 打开命令提示符并写入:

pip install nltk

This will install the natural language toolkit, after the installation is complete, open Jupyter Notebook and type: 这将安装自然语言工具包,安装完成后,打开Jupyter Notebook并输入:

import nltk
nltk.download()

It will take some time and after some time for the auto-configuration of the Jupyter Notebook. 经过一段时间后,Jupyter笔记本的自动配置需要一些时间。 Later, you would be able to use is without any issues. 之后,您将能够使用没有任何问题。 Let me know, if you still face any problem. 如果你还有任何问题,请告诉我。

如果您已经安装了anaconda发行版,默认情况下nltk会附带它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM