为python3.3.3安装nltk-3.0a3 - " ImportError:没有名为' setuptools'"

时间:2013-12-12 08:19:54

标签: python nltk setuptools python-3.3 distribute

我已经使用命令安装了Python 3.3.3:

sudo apt-get install python3

我称之为Python3,因为我也安装了Python 2.7。

我还使用命令安装distribute(setuptools):

sudo apt-get install python3-setuptools

可以肯定的是,为python3安装了setuptools,我搜索了pip3并收到了一个输出:

$ pip3 search setuptools
setuptools                - Easily download, build, install, upgrade, and
                            uninstall Python packages
INSTALLED: 2.0 (latest)

现在我想为Python 3安装NLTK的版本,所以nltk3.0a3。我从官方网站下载了它,在文件夹中我运行了一个标准的python安装并收到了一个输出:

$ python3 setup.py install
Traceback (most recent call last):
  File "setup.py", line 33, in <module>
    from setuptools import setup, find_packages
ImportError: No module named 'setuptools'

事实上,当我转到python3命令行时,对于那个输入,我看到了输出:

>>> help('modules setup')
ez_setup - Bootstrap setuptools installation
setup 
unittest.test.test_setups

所以真的没有名为setuptools的模块......

有谁知道我做错了什么?或者有没有其他方法为python 3安装NLTK? (在apt中,python 2只有NLTK。)

非常感谢你们的努力!

1 个答案:

答案 0 :(得分:0)

您可以使用μon或您喜欢的软件包管理器来安装python3-setuptools,并且http://nltk.org/nltk3-alpha/可以获得支持Python 3的实验版nltk

我怀疑你还需要为你的python 3安装pyyaml和numpy。

我试了一下:

muon

检查我是否安装了python3-setuptoolspython3-numpy

sudo pip3 install pyyaml

从上面的链接下载并解压缩代码

cd ~/ToolBuild/nltk-3.0a3/nltk-3.0a3
sudo python3 setup.py install
python3
Python 3.3.2+ (default, Oct  9 2013, 14:50:09) 
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> dir(nltk)
['AbstractLazySequence', 'AffixTagger', 'AlignedSent', 'Alignment', 'AnnotationTask', 'Assignment', 'BigramAssocMeasures', 'BigramCollocationFinder', 'BigramTagger', 'BinaryMaxentFeatureEncoding', 'BlanklineTokenizer', 'BottomUpChartParser', 'BottomUpLeftCornerChartParser', 'BottomUpProbabilisticChartParser', 'Boxer', 'BrillTagger', 'BrillTaggerTrainer', 'CfgReadingCommand', 'ChartParser', 'ChunkParserI',..........