I have followed the instruction in Trouble installing TextBlob for Python for TextBlob installation in the Windows 7.
It got installed but when I go to Python Idle and type import TextBlob
it says
No module named TextBlob
How to solve this problem?
Or can I directly place the libraries associated with the package in the Python Lib folder and try to import it in the program? If it is advisable please tell the procedure to do that. Will it work?
Any help will be highly appreciated.
In Windows, if you try installing textblob or any other packages in python, then you have to give administrative rights to the application through which you are installing the packages.
For me, it gave the same error while I was installing it through Pycharms. I gave administrative rights and it worked just fine!
pip install -U textblob
python -m textblob.download_corpora
To import just type:
from textblob import TextBlob
An example:
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...'
Install it with conda. It worked for me!
conda install -c conda-forge textblob
来源:https://stackoverflow.com/questions/24575100/textblob-installation-in-windows