我已按照Trouble installing TextBlob for Python中的说明在Windows 7中安装TextBlob。
它已经安装但是当我转到Python Idle并输入import TextBlob
时它会显示
没有名为TextBlob的模块
如何解决这个问题?
或者我可以直接将与软件包关联的库放在Python Lib文件夹中并尝试在程序中导入它吗?如果是可取的,请告诉程序这样做。 它会起作用吗?
任何帮助都将受到高度赞赏。
答案 0 :(得分:2)
答案 1 :(得分:2)
在Windows中,如果您尝试在python中安装textblob或任何其他软件包,则必须为安装软件包的应用程序授予管理权限。
对我来说,当我通过Pycharms安装它时,它给出了同样的错误。我给了行政权利,工作得很好!
from textblob import TextBlob
text = '''
The titular threat of The Blob has always struck me as the ultimate movie
monster: an insatiably hungry, amoeba-like mass able to penetrate
virtually any safeguard, capable of--as a doomed doctor chillingly
describes it--"assimilating flesh on contact.
Snide comparisons to gelatin be damned, it's a concept with the most
devastating of potential consequences, not unlike the grey goo scenario
proposed by technological theorists fearful of
artificial intelligence run rampant.
'''
blob = TextBlob(text)
blob.tags # [('The', 'DT'), ('titular', 'JJ'),
# ('threat', 'NN'), ('of', 'IN'), ...]
blob.noun_phrases # WordList(['titular threat', 'blob',
# 'ultimate movie monster',
# 'amoeba-like mass', ...])
for sentence in blob.sentences:
print(sentence.sentiment.polarity)
# 0.060
# -0.341
blob.translate(to="es") # 'La amenaza titular de The Blob...'
8081
答案 2 :(得分:2)
用conda安装它。它对我有用!
conda install -c conda-forge textblob
答案 3 :(得分:0)
答案 4 :(得分:0)
conda install -c conda-forge textblob
这在Jupyter环境中有效。