Background of the problem
Getting started with Python
try to use pyldavis for simple topic extraction;
Problems and related codes
Pyldavis has been installed, as shown in the figure (Annotated):
but an error occurs when entering the following statement:
error code segment:
import pyLDAvis
import pyLDAvis.sklearn
pyLDAvis.enable_notebook()
pyLDAvis.sklearn.prepare(lda,tf,tf_vectorizer)
Screenshot of specific error reporting:
Solution:
Some bloggers suggested that the installation was not successful. I installed it as an administrator. I operated it, but it was useless
in fact, the final solution is very simple. I found that the kernel used by my Jupiter notebook is wrong. I used a virtual environment I set up before. Just change it to the default environment (my one is named python3).