TextBlob installation in windows

旧街凉风 提交于 2019-12-22 10:09:10

问题


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.


回答1:


Try this:

from textblob import TextBlob

Source: TextBlob package description




回答2:


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...'



回答3:


Install it with conda. It worked for me!

conda install -c conda-forge textblob



回答4:


try

pip install textblob

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




回答5:


conda install -c conda-forge textblob

This worked in Jupyter environment.



来源:https://stackoverflow.com/questions/24575100/textblob-installation-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!