我尝试卸载并重新安装Keras,Tensorflow,但未找到任何解决方案。
from keras.utils.np_utils import to_categorical
Y_train = to_categorical(y_train, num_classes=None)
Y_test = to_categorical(y_test, num_classes=None)
print(Y_train.shape)
ImportError Traceback (most recent call last)
~\Anaconda3\envs\nnet\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>()
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import __version__
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-6-3cac28c3a2f2> in <module>()
答案 0 :(得分:0)
对于keras,较新的keras版本请使用from keras.utils import to_categorical
。
如果您有较老的keras,请尝试使用以下命令安装np_utils:
pip install np_utils
安装后和重新启动内核。