5

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.

Community
  • 1
  • 1
Selva Perumal
  • 71
  • 2
  • 3
  • 6

5 Answers5

4

Install it with conda. It worked for me!

conda install -c conda-forge textblob
3

Try this:

from textblob import TextBlob

Source: TextBlob package description

ncocacola
  • 485
  • 3
  • 9
3

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...'
Krishna
  • 484
  • 7
  • 22
0

try

pip install textblob

if you dont have pip, you can get it here, it's really usefull

shudima
  • 460
  • 1
  • 5
  • 9
0
conda install -c conda-forge textblob

This worked in Jupyter environment.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93