python - 导入错误 : cannot import name 'LatentDirichletAllocation' when importing PCA

标签 python scikit-learn pca

<分区>

我不断收到错误:

ImportError:无法导入名称“LatentDirichletAllocation”

完整回溯:

Traceback (most recent call last):
  File "/home/path/to/file/pca.py", line 7, in <module>
    from sklearn.decomposition import PCA
  File "/home/user/.local/lib/python3.6/site-packages/sklearn/decomposition/__init__.py", line 19, in <module>
    from ._online_lda import LatentDirichletAllocation
ImportError: cannot import name 'LatentDirichletAllocation'

当我尝试使用以下方法导入 PCA 时:

sklearn.decomposition 导入 PCA

我删除了 sklearn 文件夹,但仍然出现错误。

最佳答案

安装失败。

尝试:

对于 Python 2

pip uninstall scikit-learn
pip install -U scikit-learn==0.20.4

对于 Python 3

pip3 uninstall scikit-learn
pip3 install -U scikit-learn==0.21.3

关于python - 导入错误 : cannot import name 'LatentDirichletAllocation' when importing PCA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59321650/

相关文章:

python - 在 2d numpy 数组列上计算成对 t 检验

machine-learning - OneHotEncoder 中的 active_features_ 属性

python - 使用imputer后如何将数据放入数据框中?

python - 如何使用 Python 和 Scikit 学习使用一种热编码进行线性回归?

R Plot_ly : How to change colorbar color palette and colorthreshold values?

python - 如何用beautifulsoup提取h1标签文本

python - 类名作为python中的变量

java - Java 中的快速矩阵计算

python - 使用 pandas 数据框进行主成分分析

Python 扩展(Boost.Python & Py++)和 dlopen 混淆