没有找到名为"mlxtend"的模块。

9

我无法在Jupyter Python3笔记本中安装mlxtend包。

我已经尝试了pip install mlxtend或pip3 install mlxtend,但是它要么显示Python2的语法错误,要么告诉我在Python3命令行中尝试。我已经尝试在命令行上安装它,但它显示“ERROR: Could not find a version that satisfies the requirement mlextend (from versions: none) ERROR: No matching distribution found for mlextend”。

from mlxtend.frequent_patterns import apriori
from mlxtend.frequent_patterns import association_rules


ModuleNotFoundError                       Traceback (most recent call 
last)
<ipython-input-3-73c97be96c5f> in <module>()
----> 1 from mlxtend.frequent_patterns import apriori
      2 from mlxtend.frequent_patterns import association_rules

ModuleNotFoundError: No module named 'mlxtend'`enter code here`
6个回答

12
您需要使用以下命令:

pip install mlxtend

您当前正在尝试安装mlextend(不存在)而不是mlxtend


1
抱歉问题中有错别字。但我尝试了pip或pip3安装mlxtend,但没有成功。抱歉,我是初学者,所以这个问题可能有点傻:p - Jayesh Kumar
我刚刚运行了这个命令,对我来说它很好用: 成功安装cycler-0.10.0 joblib-0.13.2 kiwisolver-1.1.0 matplotlib-3.1.1 mlxtend-0.16.0 numpy-1.16.4 pandas-0.24.2 pyparsing-2.4.0 scikit-learn-0.21.2 scipy-1.3.0 - Nordle
1
这个解决方案在Anaconda Prompt中对我也起作用了。谢谢,@Nordle! - daniness

3

最近我也遇到了同样的问题。解决方法是先导入模块,然后再获取组件:

import mlxtend
from mlxtend.frequent_patterns import apriori
from mlxtend.frequent_patterns import association_rules

1
为了补充上述可能的解决方案。在Anaconda/Miniconda环境下,也可以使用conda。在https://anaconda.org/conda-forge/mlxtend下的各种选项中,以下内容对我有效:
conda install -c conda-forge mlxtend

0

'pip install' 可以在 Python2 上使用,如果你要在 Python3 上安装,请使用 pip3 install mlxtend


File "<ipython-input-5-2ddfbd4be129>", line 1 pip3 install mlxtend ^ SyntaxError: invalid syntax - Jayesh Kumar
@JayeshKumar!在jupyter笔记本中使用Linux命令时,需要在开头加上!pip3 install mlxtend。 - Thinh Phung

0

使用!pip install mlxtend。它一定会有效。


-1
#Import the libraries
#To install mlxtend run : pip install mlxtend

import pandas as pd
from mlxtend.preprocessing import TransactionEncoder
from mlxtend.frequent_patterns import association_rules,apriori

1
这并没有回答问题。问题是关于 pip install 无法工作的。 - Piotr Siupa

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接