ModuleNotFoundError: No Module named 'tensorflow.python' when trying to import tensorflow module
ModuleNotFoundError: No Module named 'tensorflow.python' when trying to import tensorflow module
我正在做一个项目,我必须在我的 Windows10 机器上使用 TensorFlow 和 Keras 模块。
我首先使用 anaconda prompt
创建了我的虚拟环境
$ conda create -n tensor-env
$ conda activate tensor-env
在此之后,我安装了一些我需要使用的 python 库。
当我执行 $conda list
时,我可以看到已安装 TensorFlow (see image)。
但在此之后,当我尝试在我的 .py 文件上使用它时,我收到一条错误消息,指出它找不到模块 (see image)。
我是不是漏掉了什么?到目前为止,我已经尝试了很多教程,但我看不出如何解决这个问题,我是不是缺少 CPU TensorFlow 安装或其他东西?
感谢大家的阅读:)
创建虚拟环境后,您需要再次将 tensorflow 和 keras 安装到该环境中以 运行 您的程序。
您可以 运行 在 anaconda 提示符下执行以下命令。
conda create -n tensor-env
conda activate tensor-env
conda install tensorflow
conda install keras
现在 select 在 anaconda navigator 中这个环境,并在相同的环境中打开 jupyter notebook 到 运行 程序。
如果这解决了您的程序错误,请告诉我。
我正在做一个项目,我必须在我的 Windows10 机器上使用 TensorFlow 和 Keras 模块。 我首先使用 anaconda prompt
创建了我的虚拟环境$ conda create -n tensor-env
$ conda activate tensor-env
在此之后,我安装了一些我需要使用的 python 库。
当我执行 $conda list
时,我可以看到已安装 TensorFlow (see image)。
但在此之后,当我尝试在我的 .py 文件上使用它时,我收到一条错误消息,指出它找不到模块 (see image)。
我是不是漏掉了什么?到目前为止,我已经尝试了很多教程,但我看不出如何解决这个问题,我是不是缺少 CPU TensorFlow 安装或其他东西?
感谢大家的阅读:)
创建虚拟环境后,您需要再次将 tensorflow 和 keras 安装到该环境中以 运行 您的程序。
您可以 运行 在 anaconda 提示符下执行以下命令。
conda create -n tensor-env
conda activate tensor-env
conda install tensorflow
conda install keras
现在 select 在 anaconda navigator 中这个环境,并在相同的环境中打开 jupyter notebook 到 运行 程序。 如果这解决了您的程序错误,请告诉我。