我在Ubuntu16.04上使用Python3.5.2。
我用..安装了滑雪板。
sudo apt install python-sklearn
并且使用..。
sudo pip3 install mlxtend
我正在尝试运行在互联网上找到的基本Iris示例,但是当我试图从plot_decision_regions导入mlxtend.plotting时,我就会得到一个错误
from mlxtend.plotting import plot_decision_regions
Traceback (most recent call last):
File "scripts/machine.learning.py", line 6, in <module>
from mlxtend.plotting import plot_decision_regions
File "/usr/local/lib/python3.5/dist-packages/mlxtend/plotting/__init__.py", line 15, in <module>
from .heatmap import heatmap
File "/usr/local/lib/python3.5/dist-packages/mlxtend/plotting/heatmap.py", line 74
raise AssertionError(f'len(row_names) (got {len(row_names)})'
^
SyntaxError: invalid syntax发布于 2019-09-23 09:56:52
我也犯了同样的错误,只需升级到python3.7,真正的错误是
python 3.5不支持f前缀
使用conda进行升级
conda install -c anaconda python=3.7然后更新所有的依赖项。
conda update --all发布于 2019-07-31 04:57:05
我没有看到与您相同的错误,但是尝试将legend=range(105, 150)从plot_decision_regions中删除。
plot_decision_regions(x_combined, y_combined, clf=tree)我用的是最新的滑雪板。
import sklearn
sklearn.__version__“0.21.3”
也许删除那个版本
sudo apt-get remove python-sklearn然后通过pip安装,即
pip3 install scikit-learnhttps://stackoverflow.com/questions/57283294
复制相似问题