[英]Can't import nltk even though it is installed on my machine
When I open a jupyter notebook and try to import NLTK it errors.当我打开一个 jupyter 笔记本并尝试导入 NLTK 时,它会出错。 I can import other packages but I cannot import NLTK我可以导入其他包,但无法导入 NLTK
I'll add a screenshot below to illustrate all of this but我将在下面添加一个屏幕截图来说明所有这些,但是
pip3 install nltk
on my mac我用pip3 install nltk
在我的 Mac 上安装了 nltkpip show nltk
to see the successful installation我可以运行pip show nltk
来查看安装成功import nltk
nltk.download()
your python installations and your ipython are separate.你的 python 安装和你的 ipython 是分开的。
Hello,你好,
if you run Mac/Unix如果你运行Mac/Unix
Install NLTK: run pip install --user -U nltk安装 NLTK:运行 pip install --user -U nltk
Install Numpy (optional): run pip install --user -U numpy安装 Numpy(可选):运行 pip install --user -U numpy
Test installation: run python then type import nltk测试安装:运行python然后输入import nltk
For older versions of Python it might be necessary to install setuptools (see https://pypi.python.org/pypi/setuptools ) and to install pip (sudo easy_install pip).对于较旧版本的 Python,可能需要安装 setuptools(请参阅https://pypi.python.org/pypi/setuptools )和安装 pip(sudo easy_install pip)。
Windows视窗
These instructions assume that you do not already have Python installed on your machine.这些说明假定您的机器上尚未安装 Python。
32-bit binary installation Install Python 3.8: https://www.python.org/downloads/ (avoid the 64-bit versions) 32 位二进制安装 安装 Python 3.8: https ://www.python.org/downloads/(避免使用 64 位版本)
Install Numpy (optional): https://www.scipy.org/scipylib/download.html安装 Numpy(可选): https ://www.scipy.org/scipylib/download.html
Install NLTK: https://pypi.python.org/pypi/nltk安装 NLTK: https ://pypi.python.org/pypi/nltk
Test installation: Start>Python38, then type import nltk测试安装:开始>Python38,然后输入import nltk
And if it doesnt work, install nltk using Conda By :如果它不起作用,请使用 Conda By 安装 nltk:
conda install -c anaconda nltk
For more info check : https://www.nltk.org/install.html欲了解更多信息检查: https ://www.nltk.org/install.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.