【问题标题】:Installation of nltk-3.0a3 for python3.3.3 - "ImportError: No module named 'setuptools'"为 python3.3.3 安装 nltk-3.0a3 -“ImportError: No module named 'setuptools'”
【发布时间】:2013-12-30 13:22:43
【问题描述】:

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

sudo apt-get install python3

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

我还使用命令安装了分发(setuptools):

sudo apt-get install python3-setuptools

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

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

现在我想安装 NLTK 的 Python 3 版本,所以 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)。

非常感谢大家的努力!

【问题讨论】:

  • 如果在 Python 3 命令行中输入 import setuptools 会发生什么?
  • 谢谢,同样的:“Traceback(最近一次调用最后一次):文件“”,第 1 行,在 中 ImportError:没有名为“setuptools”的模块”

标签: python nltk setuptools python-3.3 distribute


【解决方案1】:

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

我怀疑您还需要为您的 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',..........

【讨论】:

  • 嗨,史蒂夫,感谢您的回答。如果您阅读了我的帖子,您就会知道这正是我所做的。
  • 如果你进入 python3 并输入 import setuptools 会发生什么?
猜你喜欢
  • 1970-01-01
  • 2018-09-29
  • 2021-03-13
  • 2014-10-11
  • 1970-01-01
  • 2016-03-27
  • 2017-05-30
  • 2012-04-21
  • 2016-04-27
相关资源
最近更新 更多