添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I installed text blob with the line below on my PC:

$ git clone https://github.com/sloria/TextBlob.git

This then happened:

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.

I wanted to test it with the simple script below:

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)

But I got this error and I do not know how to move forward:

Traceback (most recent call last):
  File "textblob_install.py", line 1, in <module>
    from textblob import textblob
ImportError: No module named textblob

Please help (new to Python)

You didn't actually install TextBlob, you only downloaded it. It is much easier to use pip or conda for installation than to install it from the GitHub repo. – iz_ Nov 16, 2018 at 23:21

Use python -m pip install textblob. If you are using conda or virtualenv, you'll want to activate that environment before installing.

git clone <blah> will put files onto your computer, but your python interpreter doesn't know where those files are. The git repo probably has files like a setup.py among others, which can help you install it, but again it needs to still be installed in a useable way in the site-packages directory of your python installation.

Note, do not git clone into site-packages, it will throw errors like "TextBlob is not a python module"

It is required to download and import library

!pip install textblob      #for installation
import textblob            #to import
from textblob import TextBlob

Ran into the same issue: TextBlob's documentation seems to indicate that 2 steps are required to install textblob:

pip install -U textblob
python -m textblob.download_corpora

After doing that, it worked for me. Documentation found at https://textblob.readthedocs.io/en/dev/

You need to install the package according to your python-version, in my case (Python3) I use the incorrect one, because the first time was:

!pip install textblob

And the correct instruction is:

!pip3 install textblob

The installation of the package not completed. You should install the package properly.

pip install -U textblob

please refer the following link for more information readthedocs

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.