Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/356.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 如何解决ModuleNotFoundError:没有名为';tensorflow';问题_Python_Tensorflow_Keras_Deep Learning_Pip - Fatal编程技术网

Python 如何解决ModuleNotFoundError:没有名为';tensorflow';问题

Python 如何解决ModuleNotFoundError:没有名为';tensorflow';问题,python,tensorflow,keras,deep-learning,pip,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

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:
环境是Windows8.1、Python3.7.1、PIP20.1.1

当我运行这个测试文件时

import tensorflow as tf
hello = tf.constant("hello TensorFlow!")
sess=tf.Session()
print(sess.run(hello))
,我收到以下错误消息:

ModuleNotFoundError: No module named 'tensorflow'.

如何解决此问题?

只需使用pip安装即可:

pip install tensorflow
查看此页:

您可能有多个python安装或虚拟环境,我想我有。我应该怎么做?你用什么来编辑你的代码?您只需为tensorflow选择好的python环境。我正在使用Pycharm。Q的第一行是:“tensorflow已成功安装”,我是用pip安装的。如果您使用的是virtualenv,请从virtualenv中安装。tensorflow安装在Anaconda文件夹“C:\Users\..\Anaconda3\Lib\site packages”上,但我应该在上安装它“C:\Users\…\venv\Lib\site packages”。我如何才能做到这一点?