为什么显示错误"import nltk"? [英] Why shows error "import nltk"?

查看:439
本文介绍了为什么显示错误"import nltk"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python构建网络搜寻器,执行该程序时出现以下错误.

I was trying to build web crawler using python and I'v got following error when it executed.

import sys
import math
import re
from collections import OrderedDict, defaultdict
import os
import nltk //This line shows error
import pickle
from xml.dom import minidom
from xml.dom import EMPTY_NAMESPACE
import nltk  //This line shows error
from nltk.stem.porter import PorterStemmer
import time`enter code here`

如何克服这个问题?

推荐答案

首先,您可以检查是否已安装nltk. 否则,您可以从这里下载.

First you can check whether already nltk you have installed or not. Otherwise you can download from here.

NLTK下载链接

在Ubuntu中,您可以尝试以下方法之一:

In ubuntu, you can try followng one:

sudo apt-get install python-nltk

这篇关于为什么显示错误"import nltk"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆