NLP的搭建

系统ubuntu

安装NLTK之前,先用一下apt-cache search命令搜索一下NLTK包在软件源中具体的名字:

$ apt-cache search nltk    #搜索软件包

$ apt-cache depends python-nltk        #了解具体依赖的包

具体步骤如下:

首先安装setuptools(http://pypi.python.org/pypi/setuptools),

如果你进入上面的链接,会发现按照里面的提示安装,是不能成功的。

下面,我把这步说一下:

首先:
1.wget -q http://peak.telecommunity.com/dist/ez_setup.py

2.python ez_setup.py         ( 这一步必然失败,是为了第三步取得url准备的.)

运行这行的时候,linux会停留在Downling ~~~~~这类似的上面.

这是因为你的这个目录下中没有setuptools-0.6c8-py2.4.egg东西.

3.    wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c8-py*.*.egg

改成相应的python版本即可,


你也可以直接下载setuptools-0.6c8-py*.*.egg,然后运行

sudo sh 文件路径

注意:第三步的url是根据第二步得到的url.

 


然后,安装pip。sudo easy_install pip

然后,安装Numpy sudo pip install -U numpy,这个可能出错,例如缺少python-dev等等,具体看自己的情况。

然后,就是PyYaml sudo pip install -U Pyyaml

然后,安装nltk

最后就是测试nltk:

在终端下输入import nltk,不报错就成功了。


这边是英文原文

  1. Install Setuptools: Download the corresponding version of Setuptools fromhttp://pypi.python.org/pypi/setuptools (scroll to the bottom, and pick the filename that contains the right version number and which has the extension .egg). Install it by typing sudo sh Downloads/setuptools-...egg, giving the location of the downloaded file.
  2. Install Pip: run sudo easy_install pip
  3. Install Numpy (optional): run sudopipinstall -Unumpy
  4. Install PyYAML and NLTK: run sudopipinstall -Upyyamlnltk(建议分两步)
  5. Test installation: run python then typeimportnltk

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值