运行python程序时的ImportError

时间:2016-03-10 09:49:59

标签: python python-2.7

我已经尝试了所有导入方法并升级了库,但我仍然无法克服此错误。我已经以编程方式下载并安装了所有nltk和corpus数据,它在python shell中工作,但我收到错误。

    Traceback (most recent call last):
  File "spark.py", line 7, in <module>
    from textblob_aptagger import PerceptronTagger
  File "/usr/local/lib/python2.7/dist-packages/textblob_aptagger/__init__.py", line 8, in <module>
    from textblob_aptagger.taggers import PerceptronTagger
  File "/usr/local/lib/python2.7/dist-packages/textblob_aptagger/taggers.py", line 10, in <module>
    from textblob.packages import nltk
ImportError: No module named packages

Here是我的代码和导入的一个pastebin ..

1 个答案:

答案 0 :(得分:1)

在github here上发布了同样的错误。使用它来代替安装textblob:

$ pip install -U git+https://github.com/sloria/textblob-aptagger.git@dev

此外,您应该将from text.blob import TextBlob as tb更改为from textblob...

为我工作..