加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – Keras:无法导入名称np_utils

发布时间:2020-12-16 22:31:53 所属栏目:Python 来源:网络整理
导读:参见英文答案 ImportError: cannot import name np_utils????????????????????????????????????6个 我正在使用Python 2.7和Jupyter笔记本来做一些基本的机器学习.我正在关注本教程: http://machinelearningmastery.com/regression-tutorial-keras-deep-lear

参见英文答案 > ImportError: cannot import name np_utils????????????????????????????????????6个
我正在使用Python 2.7和Jupyter笔记本来做一些基本的机器学习.我正在关注本教程:

http://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/

我只是想从Keras导入不同的东西,所以我可以运行教程.具体来说,我这样做:

from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline

它在第一次导入时卡住了,给我一个回溯:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

我已经用Google搜索了但似乎无法找出为什么我遇到这个问题/如何修复.有任何想法吗?

谢谢!

最佳答案
该教程于2016年6月9日编写.Keras 2于2017年3月发布.尝试使用pip install keras == 1.2.2安装旧版本.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读