简体   繁体   中英

How can I solve ModuleNotFoundError in Jupyter Lab?

Here is my code about sentiment analysis in python so I had a problem on jupyter lab error is no module name but I had everything about the installing part pip install vaderSentiment and enviroment variable stuff. So What should I do?

from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
analyser = SentimentIntensityAnalyzer()

def sentiment_analyzer_scores(sentence):
    score = analyser.polarity_scores(sentence)
    print("{:-<40} {}".format(sentence, str(score)))



 ModuleNotFoundError                       Traceback (most recent call last)
    <ipython-input-22-f1fda500aee5> in <module>
    ----> 1 from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
          2 analyser = SentimentIntensityAnalyzer()
          3 
          4 def sentiment_analyzer_scores(sentence):
          5     score = analyser.polarity_scores(sentence)
    
    ModuleNotFoundError: No module named 'vaderSentiment'

Try installing its full master branch zip file and unzip it in your main file location then either try importing the same way you did or try this other line of code to import it.

from vaderSentiment import SentimentIntensityAnalyzer

Also check if you have only one version of python installed and not multiple.

Do try to upgrade pip, python and vaderSentiment to latest versions.

pip install --upgrade vaderSentiment

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM