如何解决ModuleNotFoundError:没有名为“ tensorflow”的模块的问题?

时间:2020-07-09 11:09:24

标签: python tensorflow keras deep-learning pip

Tensorflow已成功安装在我的笔记本电脑上。

Name: tensorflow
Version: 2.2.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: c:\users\my name\anaconda3\lib\site-packages
Requires: protobuf, astunparse, h5py, opt-einsum, wrapt, grpcio, termcolor, gast, tensorflow-estimator, scipy, six, tensorboard, wheel, google-pasta, numpy, keras-preprocessing, absl-py
Required-by:

环境为Windows 8.1,python 3.7.1,pip 20.1.1。

当我运行此测试文件时

import tensorflow as tf
hello = tf.constant("hello TensorFlow!")
sess=tf.Session()
print(sess.run(hello))

,我收到以下错误消息:

ModuleNotFoundError: No module named 'tensorflow'.

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

只需使用pip进行安装:

pip install tensorflow

检查此页: https://pypi.org/project/tensorflow/