在MAC OS X 10.9上安装NLTK的真正困难 [英] Real difficulty installing NLTK on MAC OS X 10.9

查看:286
本文介绍了在MAC OS X 10.9上安装NLTK的真正困难的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Python/Mac OS的新手,我正在研究NLTK教科书,但是在安装它时遇到了一些问题.我一直在寻找解决方案已有一段时间,但是不幸的是,所有解决方案似乎都无法为我工作(或者我误会了如何利用它们).

I'm new to Python/Mac OS and I'm looking to work through the NLTK textbook, but I'm having some problems installing it. I've been looking for solutions to this for a while now but unfortunately all the solutions don't seem to be able to work for me (or I'm misunderstanding exactly how to utilize them).

我遇到的基本问题是,尽管遵循了说明,但似乎未安装NLTK.以下代码给我一个错误,提示不存在这样的模块:

The basic problem I'm having is that NLTK just doesn't seem to be installed despite following the instructions. The following code gives me an error that no such module exists:

import nltk
nltk.download()

我认为我遇到的问题是pip/easy_install没有正确安装.通过阅读一些内容,我怀疑这可能与在我的计算机上安装两个版本的Python有关(Mac OS X预装了一个版本,而我安装了一个版本.)尽管目前还不确定如何检查此设置,或安装程序正在使用哪个版本的python.因此,作为第一步,如何快速检查我的计算机上是否安装了多个版本的python?

I think the problem I'm having is that pip/easy_install aren't correctly installing. From reading about a bit I suspects that this may be to do with having two versions of Python on my computer (the Mac OS X pre-installed one, and the one which I installed.) Although, at the moment I'm not sure how to check this, or which version of python the setups are utilizing. So as an initial step, how do I quickly check whether there are multiple versions of python installed on my machine?

如果这不是问题的根本原因,则下一页上所有安装pip的说明对我都不起作用(所有命令均返回语法错误):

If this turns out not to be the root cause of the problem, all of the instructions for installing pip on the following page do not work for me (all the commands return syntax errors): http://www.pip-installer.org/en/latest/installing.html.

对于这个问题的无组织处理方法,我们感到抱歉,希望我能提供一些指导,使我能够弄清哪里出了问题.

I'm sorry for the unorganized approach to this problem, hopefully with a few pointers I'll be able to work out where I'm going wrong.

推荐答案

如果您无法安装pip,请尝试: 如何在macOS或OS X上安装pip?

If you are not able to install pip try: How do I install pip on macOS or OS X?

然后尝试运行: pip install nltk

Then try running: pip install nltk

如果失败,则可能需要运行: sudo pip install nltk

If that fails you might need to run: sudo pip install nltk

完成后,您应该可以导入nltk

Once that is done you should be able to import nltk

我刚刚在特立独行者身上安装了nltk,所以我可以确认它是否有效.

I just installed nltk on mavericks so I can confirm that it works.

这篇关于在MAC OS X 10.9上安装NLTK的真正困难的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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