【发布时间】:2018-11-16 22:54:13
【问题描述】:
我在我的 PC 上安装了带有以下行的文本 blob:
$ git clone https://github.com/sloria/TextBlob.git
然后发生了:
pcarrera@LAP-JYT456465 ~/Python
$ git clone https://github.com/sloria/TextBlob.git
Cloning into 'TextBlob'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 3729 (delta 1), reused 0 (delta 0), pack-reused 3722
Receiving objects: 100% (3729/3729), 7.96 MiB | 10.79 MiB/s, done.
Resolving deltas: 100% (2054/2054), done.
我想用下面的简单脚本对其进行测试:
from textblob import textblob
text = ''' The movie was great. The movie was bad. The movie was really bad
'''
blob = textblob(text)
for sentence in blob.sentences:
print(sentence.sentiment.polarity)
但是我得到了这个错误,我不知道如何继续前进:
Traceback (most recent call last):
File "textblob_install.py", line 1, in <module>
from textblob import textblob
ImportError: No module named textblob
请帮助(Python 新手)
【问题讨论】:
-
您实际上并没有安装 TextBlob,您只是下载了它。使用
pip或conda进行安装比从 GitHub 存储库安装要容易得多。