Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ImportError:numpy.core.multiarray导入失败,无法加载本机TensorFlow运行时_Python_Tensorflow - Fatal编程技术网

Python ImportError:numpy.core.multiarray导入失败,无法加载本机TensorFlow运行时

Python ImportError:numpy.core.multiarray导入失败,无法加载本机TensorFlow运行时,python,tensorflow,Python,Tensorflow,我刚刚开始使用张量用python编写演示程序。 我是python的初学者。 我执行了命令: python./getStartWithTensor.py 但结果是 以下是我编写的代码: import tensorflow as tf # Model parameters W = tf.Variable([.3], dtype=tf.float32) b = tf.Variable([-.3], dtype=tf.float32) # Model input and output x = tf.

我刚刚开始使用张量用python编写演示程序。 我是python的初学者。 我执行了命令:

python./getStartWithTensor.py

但结果是

以下是我编写的代码:

import tensorflow as tf

# Model parameters
W = tf.Variable([.3], dtype=tf.float32)
b = tf.Variable([-.3], dtype=tf.float32)
# Model input and output
x = tf.placeholder(tf.float32)
linear_model = W*x + b
y = tf.placeholder(tf.float32)

# loss
loss = tf.reduce_sum(tf.square(linear_model - y)) # sum of the squares
# optimizer
optimizer = tf.train.GradientDescentOptimizer(0.01)
train = optimizer.minimize(loss)

# training data
x_train = [1, 2, 3, 4]
y_train = [0, -1, -2, -3]
# training loop
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init) # reset values to wrong
for i in range(1000):
  sess.run(train, {x: x_train, y: y_train})

# evaluate training accuracy
curr_W, curr_b, curr_loss = sess.run([W, b, loss], {x: x_train, y: y_train})
print("W: %s b: %s loss: %s"%(curr_W, curr_b, curr_loss))
我如何解决它?我不熟悉python和tensorflow。
谢谢。

我在网上找不到
getStartWithTensor.py
,所以我假设这是您创建的文件?请从您的
getStartWithTensor.py
中提供一个MWE,这会导致错误。@MrZ,我创建了该文件,从以下位置获得了引用: