转载: http://nicoliu.iteye.com/blog/1555625
NLTK是一个基于python的自然语言处理(NLP)工具包
安装NLTK之前,先用一下apt-cache search命令搜索一下NLTK包在软件源中具体的名字:
Shell代码
$ apt-cache search nltk #搜索软件包
python-nltk - Python libraries for natural language processing
Shell代码
$ apt-cache show python-nltk #显示版本信息/大小等
Package: python-nltk
Priority: optional
Section: universe/python
Installed-Size: 4042
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Robin Munn <robin_munn@sil.org>
Architecture: all
Source: nltk
Version: 2.0~b9-0ubuntu3
Depends: python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8), python-yaml
Suggests: python-numpy, python-matplotlib, prover9
Filename: pool/universe/n/nltk/python-nltk_2.0~b9-0ubuntu3_all.deb
Size: 918844
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
注意一下Depends/Suggests两项。或者用以下命令:
Shell代码
$ apt-cache depends python-nltk #了解具体依赖的包
python-nltk
依赖: python2.7
依赖: python
依赖: python
依赖: python-yaml
建议: python-numpy
建议: python-matplotlib
建议: prover9
了解的差不多了,开始安装:
Shell代码
$ sudo apt-get install python-nltk #安装nltk
将会安装下列额外的软件包:
libyaml-0-2 python-yaml
建议安装的软件包:
python-numpy python-matplotlib prover9
下列【新】软件包将被安装:
libyaml-0-2 python-nltk python-yaml
为了避免出现别的问题,就把建议的包全部装上呗:
Shell代码
$ sudo apt-get install python-numpy
将会安装下列额外的软件包:
libblas3gf libgfortran3 liblapack3gf
建议安装的软件包:
python-numpy-doc python-numpy-dbg python-nose python-dev gfortran
下列【新】软件包将被安装:
libblas3gf libgfortran3 liblapack3gf python-numpy
Shell代码
$ sudo apt-get install python-matplotlib #画图表要用的
将会安装下列额外的软件包:
python-matplotlib-data python-pyparsing python-support python-tz ttf-lyx
建议安装的软件包:
dvipng ipython python-configobj python-excelerator python-matplotlib-doc
python-qt3 python-qt4 python-scipy python-traits python-wxgtk2.8
texlive-extra-utils texlive-latex-extra
下列【新】软件包将被安装:
python-matplotlib python-matplotlib-data python-pyparsing python-support
python-tz ttf-lyx
Shell代码
$ sudo apt-get install prover9
将会安装下列额外的软件包:
libladr4
建议安装的软件包:
ladr4-apps prover9-doc
下列【新】软件包将被安装:
libladr4 prover9
Shell代码
$ sudo apt-get install python-scipy #俺跑MaxentClassifier要用的
将会安装下列额外的软件包:
g++ g++-4.6 libamd2.2.0 libexpat1-dev libssl-dev libssl-doc
libstdc++6-4.6-dev libumfpack5.4.0 python-dev python2.7-dev zlib1g-dev
建议安装的软件包:
g++-multilib g++-4.6-multilib gcc-4.6-doc libstdc++6-4.6-dbg
libstdc++6-4.6-doc
下列【新】软件包将被安装:
g++ g++-4.6 libamd2.2.0 libexpat1-dev libssl-dev libssl-doc
libstdc++6-4.6-dev libumfpack5.4.0 python-dev python-scipy python2.7-dev
zlib1g-dev
好了,安装完毕。打开Python交互环境,import一下,看是否安装成功。
-----------------------------------------------------------------------------------------------------
附:
https://launchpad.net/ubuntu/+source/nltk
此网站可下载到以上所有的deb安装包。