简体   繁体   English

运行python程序时ImportError

[英]ImportError while running python program

I have tried all the import methods and upgrading the libraries but still I'm unable to get over this error. 我已经尝试了所有导入方法并升级了库,但是仍然无法克服此错误。 I have downloaded and installed all the nltk and corpus data programmatically and it is working in the python shell but i'm getting error. 我已经以编程方式下载并安装了所有的nltk和语料库数据,并且它正在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 'sa pastebin to my code and imports.. 是我的代码和导入文件的粘贴框。

Same error has been posted on github here . 同样的错误已经贴在github 这里 Use this instead to install textblob: 使用它代替安装textblob:

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

Also, you should change from text.blob import TextBlob as tb to from textblob... 另外,您应该将from text.blob import TextBlob as tb更改为from textblob...

Works for me.. 为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM