pycharm中出现的错误

时间:2021-07-16 04:53:35

错误1

在pycharm上安装TensorFlow运行import tensorflow时报错:

File "<frozen importlib._bootstrap>", line , in _find_and_load SystemError: PyEval_EvalFrameEx 。。。。。。。。。。。。。。。

。。。。。。。Check failed: PyBfloat16_Type.tp_base != nullptr

1)解决方法:

    升级numpy后成功

    

  pip install numpy --upgrade

from numpy import arrayfrom keras.models import Sequentialfrom keras.layers import LSTMfrom keras.layers import Dense# define datasetX = array([[10, 20, 30], [20, 30, 40], [30, 40, 50], [40, 50, 60]])y = array([40, 50, 60, 70])# reshape from [samples, timesteps] into [samples, timesteps, features]X = X.reshape((X.shape[0], X.shape[1], 1))# define modelmodel = Sequential()model.add(LSTM(50, activation='relu', input_shape=(3, 1)))model.add(Dense(1))model.compile(optimizer='adam', loss='mse')# fit modelmodel.fit(X, y, epochs=1000, verbose=0)# demonstrate predictionx_input = array([50, 60, 70])x_input = x_input.reshape((1, 3, 1))yhat = model.predict(x_input, verbose=0)print(yhat)--------------------- 作者:njzhuming 来源:CSDN 原文:https://blog.csdn.net/njzhuming/article/details/84901409 版权声明:本文为博主原创文章,转载请附上博文链接!