python运行时:ModuleNotFoundError: No module named ‘tensorflow‘

2023-11-16

TensorFlow报错:
python或者anaconda运行时显示:
在这里插入图片描述
一般的解决方案:

pip install --upgrade --ignore-installed tensorflow

或者

pip install --user --upgrade --ignore-installed tensorflow

在DOS窗口运行结果如下:
在这里插入图片描述
输入以下命令也是报错:

pip install --upgrade --ignore-installed tensorflow-gpu
pip3 install tensorflow #cpu
pip3 install tensorflow-gpu

在这里插入图片描述
那么------既然找不到TensorFlow的版本,那我们就自行查找,输入:

pip3 search tensorflow

会出现一大堆的信息

tensorflow (2.3.1)                                 - TensorFlow is an open source machine learning framework for
                                                     everyone.
tensorflow-qndex (0.0.22)                          - tensorflow-qnd x tensorflow-extenteten
tensorflow-plot (0.3.2)                            - TensorFlow Plot
tensorflow-addons (0.11.2)                         - TensorFlow Addons.
tensorflow-estimator (2.3.0)                       - TensorFlow Estimator.
tensorflow-ops (0.0.0)                             - tensorflow-ops
mesh-tensorflow (0.1.17)                           - Mesh TensorFlow
tensorflow-io (0.16.0)                             - TensorFlow IO
tensorflow-recommenders (0.2.0)                    - Tensorflow Recommenders, a TensorFlow library for recommender
                                                     systems.
tensorflow-datasets (4.1.0)                        - tensorflow/datasets is a library of datasets ready to use with
                                                     TensorFlow.
tensorflow-scientific (0.2.0.dev0)                 - Scientific modeling in TensorFlow
tensorflow-k8s (0.0.2)                             - Tensorflow serving extension
emloop-tensorflow (0.6.0)                          - TensorFlow extension for emloop.
axion-tensorflow (0.0.5)                           - axion for TensorFlow >=2.2.
daltons-tensorflow (0.0.17)                        - Daltons Tensorflow bindings
tensorflow-extenteten (0.0.22)                     - TensorFlow extention library
Tensorflow-ChatBots (0.0.12)                       - ChatBots supporting TensorFlow
cxflow-tensorflow (0.5.0)                          - TensorFlow extension for cxflow.
tensorflow-compression (1.3)                       - Data compression in TensorFlow
syft-tensorflow (0.1.0)                            - TensorFlow Bindings for PySyft
tensorflow-coder (0.0.2)                           - TensorFlow Coder (TF-Coder): A Program Synthesis Tool for
                                                     TensorFlow
dask-tensorflow (0.0.2)                            - Interactions between Dask and Tensorflow
tensorflow-tracer (1.1.0)                          - Runtime Tracing Library for TensorFlow
tensorflow-radam (0.15.0)                          - RAdam implemented in Keras & TensorFlow
redhat-tensorflow (0.0.0)                          - A build of TensorFlow by Red Hat
aicoe-tensorflow (0.0.0)                           - A build of TensorFlow by Red Hat
gmlsnets-tensorflow (0.1)                          - GMLS-Nets Tensorflow implementation
tensorflow-transform (0.25.0)                      - A library for data preprocessing with TensorFlow
rh-tensorflow (0.0.0)                              - A build of TensorFlow by Red Hat
sagemaker-tensorflow (2.3.0.1.0.0)                 - Amazon Sagemaker specific TensorFlow extensions.
tensorflow-manopt (0.1.0)                          - A library for manifold-constrained optimization in TensorFlow
tensorflow-qnd (0.1.11)                            - Quick and Dirty TensorFlow command framework
tensorflow-probability (0.11.1)                    - Probabilistic modeling and statistical inference in TensorFlow
tensorflow-determinism (0.3.0)                     - Tracking, debugging, and patching non-determinism in TensorFlow
tensorflow-model (0.1.1)                           - Command-line tool to inspect TensorFlow models
tensorflow-utils (0.1.0)                           - Classes and methods to make using TensorFlow easier
tensorflow-ranking (0.3.2)                         - Pip package setup file for TensorFlow Ranking.
tensorflow-cpu-estimator (1.15.1)                  - TensorFlow Estimator.
tensorflow-io-nightly (0.17.0.dev20201108041428)   - TensorFlow IO
tensorflow-gpu-estimator (2.3.0)                   - TensorFlow Estimator.
tensorflow-lattice-gpu (0.9.8)                     - TensorFlow Lattice provides lattice models in TensorFlow
tensorflow-directml (1.15.3.dev200911)             - TensorFlow is an open source machine learning framework for
                                                     everyone.
tensorflow-aarch64 (1.2)                           - Tensorflow r1.2 for aarch64[arm64,pine64] CPU only.
tensorflow-gan (2.0.0)                             - TF-GAN: A Generative Adversarial Networks library for TensorFlow.
tensorflow-tflex (1.13.1rc3)                       - TensorFlow is an open source machine learning framework for
                                                     everyone.
tensorflow-fedora28 (1.9.0rc0)                     - TensorFlow is an open source machine learning framework for
                                                     everyone.
tensorflow-federated (0.17.0)                      - TensorFlow Federated is an open-source federated learning
                                                     framework.
tensorflow-rl (0.2.2)                              - tensorflow-rl: Modular Deep Reinforcement Learning Framework.
tensorflow-gpu (2.3.1)                             - TensorFlow is an open source machine learning framework for
                                                     everyone.
intel-tensorflow (2.3.0)                           - TensorFlow is an open source machine learning framework for
                                                     everyone.
tensorflow-font2char2word2sent2doc (0.0.12)        - TensorFlow implementation of Hierarchical Attention Networks for
                                                     Document Classification
tensorflow-template (0.2)                          - A tensorflow template for quick starting a deep learning project.
tensorflow-rocm (2.3.2)                            - TensorFlow is an open source machine learning framework for
                                                     everyone.
tensorflow-cpu (2.3.1)                             - TensorFlow is an open source machine learning framework for
                                                     everyone.
essentia-tensorflow (2.1b6.dev236)                 - Library for audio and music analysis, description and synthesis,
                                                     with TensorFlow support
tensorflow-quantum (0.4.0)                         - TensorFlow Quantum is a library for hybrid quantum-classical
                                                     machine learning.
tensorflow-encrypted (0.4.0)                       - Layer on top of TensorFlow for doing machine learning on
                                                     encrypted data.
tensorflow-text (2.3.0)                            - TF.Text is a TensorFlow library of text related ops, modules, and
                                                     subgraphs.
silence-tensorflow (1.1.1)                         - Simple python package to shut up Tensorflow warnings and logs.
tensorflow-cloud (0.1.9)                           - The TensorFlow Cloud repository provides APIs that will allow to
                                                     easily go from debugging and training your Keras and TensorFlow
                                                     code in a local environment to distributed training in the cloud.
tensorflow-fewshot (0.0.3)                         - A Python package for few shot learning training and inference in
                                                     computer vision using Tensorflow.
tensorflow-serving-client (1.0.0)                  - Python client for tensorflow serving
tensorflow-transform-canary (0.9.0)                - A library for data preprocessing with TensorFlow
rav-tensorflow-transform (0.7.0.910)               - A library for data preprocessing with TensorFlow
tensorflow-serving-api (2.3.0)                     - TensorFlow Serving Python API.
tensorflow-model-analysis (0.25.0)                 - A library for analyzing TensorFlow models
tensorflow-onmttok-ops (0.4.0)                     - OpenNMT Tokenizer as TensorFlow Operations
tensorflow-play (0.0.1)                            - The lightweight engineering TensorFlow wrapper for AI engineer.
                                                     Write less, Reuse more, Scale easily.
tensorflow-hub (0.10.0)                            - TensorFlow Hub is a library to foster the publication, discovery,
                                                     and consumption of reusable parts of machine learning models.
tensorflow-kernels (0.1.2)                         - A package with Tensorflow (both CPU and GPU) implementation of
                                                     most popular Kernels for kernels methods (SVM, MKL...).
tensorflow-graphics (2020.5.20)                    - A library that contains well defined, reusable and cleanly
                                                     written graphics related ops and utility functions for
                                                     TensorFlow.
tensorflow-io-2.0-preview (0.7.0.dev1369)          - TensorFlow IO
tensorflow-constrained-optimization (0.2)          - A library for performing constrained optimization in TensorFlow
ngraph-tensorflow-bridge (0.18.0)                  - Intel nGraph compiler and runtime for TensorFlow
tensorflow-technical-indicators (0.1.2)            - Technical Indicators as TensorFlow Graph Functions
tensorflow-deploy-utils (1.0.0)                    - Utils for managing and communication with TensorFlow Deploy
intel-tensorflow-avx512 (2.3.0)                    - TensorFlow is an open source machine learning framework for
                                                     everyone.
tensorflow-federated-nightly (0.17.0.dev20201107)  - TensorFlow Federated is an open-source federated learning
                                                     framework.
tensorflow-rocm-enhanced (2.3.2)                   - TensorFlow is an open source machine learning framework for
                                                     everyone.
simple-tensorflow-serving (0.8.1.1)                - The simpler and easy-to-use serving service for TensorFlow models
Tensorflow-Telegram-Bot (0.0.2)                    - TensorFlow Telegram Bot which can be used as callback
tensorflow-serving-client-grpc (2.3.0)             - A prebuilt tensorflow serving client from the tensorflow serving
                                                     proto files
neuraxle-tensorflow (0.1.2)                        - TensorFlow steps, savers, and utilities for Neuraxle. Neuraxle is
                                                     a Machine Learning (ML) library for building neat pipelines,
                                                     providing the right abstractions to both ease research,
                                                     development, and deployment of your ML applications.
attention-tensorflow-mesh (0.0.2)                  - A bunch of attention related functions, for constructing
                                                     transformers in tensorflow mesh
tensorflow-serving-api-gpu (2.3.0)                 - TensorFlow Serving Python API.
spark-tensorflow-distributor (0.1.0)               - This package helps users do distributed training with TensorFlow
                                                     on their Spark clusters.
tensorflow-auto-detect (1.11.0)                    - Automatically install CPU or GPU tensorflow determined by looking
                                                     for a CUDA installation.
tensorflow-gcs-config (2.3.0)                      - TensorFlow operations for configuring access to GCS (Google
                                                     Compute Storage) resources.
sagemaker-tensorflow-training (20.1.4)             - Open source library for creating TensorFlow containers to run on
                                                     Amazon SageMaker.
tensorflow-object-detection-api (0.1.1)            - Tensorflow Object Detection Library Packaged
tensorflow-coder-colab-logging (0.0.2)             - Logging utilities for TensorFlow Coder's Colab interface
tensorflow-serving-api-python3 (1.8.0)             - *UNOFFICIAL* TensorFlow Serving API libraries for Python3
tensorflow-graphics-gpu (1.0.0)                    - A library that contains well defined, reusable and cleanly
                                                     written graphics related ops and utility functions for
                                                     TensorFlow.
yifeif-tensorflow-graphics (2020.6.11)             - A library that contains well defined, reusable and cleanly
                                                     written graphics related ops and utility functions for
                                                     TensorFlow.
tensorflow-exercise-hx (1.0.1)                     - tensorflow练习:鸢尾花&#31181
                                                     ;类预测,加州房价
                                                     预测
tensorflow-enterprise-addons (0.1.1)               - Client-side library suite of TensorFlow Enterprise on Google
                                                     CloudPlatform (GCP), which implements specific integration
                                                     between GCP andTensorFlow APIs.
tensorflow-consciousness (0.1)                     - Supports a variety of biological learning algorithms.
mlops-tensorflow (0.1.0)                           -
tensorflow-privacy (0.5.1)                         -
resnet-tensorflow (0.0.1)                          - Deep Residual Neural Network

查询python 的版本:

>>>C:\Users\pc>python
Python 3.9.0a4 (tags/v3.9.0a4:6e02691, Feb 25 2020, 23:23:54) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

-----------------------------发现问题----------------------
安装不成功的原因是:
1:电脑是32bit的
2:Python版本高于3.6

查询系统版本:

python -v
# D:\Python3.9\lib\__pycache__\_sitebuiltins.cpython-39.pyc matches D:\Python3.9\lib\_sitebuiltins.py
# code object from 'D:\\Python3.9\\lib\\__pycache__\\_sitebuiltins.cpython-39.pyc'
import '_sitebuiltins' # <_frozen_importlib_external.SourceFileLoader object at 0x000002885BD175E0>
import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x000002885BD05280>
Python 3.9.0a4 (tags/v3.9.0a4:6e02691, Feb 25 2020, 23:23:54) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
>>>

如下图:Python是3.9 环境是64bit
在这里插入图片描述
版本高于3.6,打开Anaconda查看其Python版本
在这里插入图片描述
安装TensorFlow方法:
CPU版本的安装

pip install --ignore-installed --upgrade tensorflow

安装步骤:
1:TensorFlow在Windows下,支持Python 3.6版本
2:在DOS窗口中输入:[目的:输入清华仓库镜像,加快更新速度]

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

3:然后再输入:

conda config --set show_channel_urls yes

4:Anaconda3创建一个python3.6的环境,环境名称为tensorflow ,命令如下:

conda create -n tensorflow python=3.6

anaconda在这里的意思安装依赖包,所以要下载一会~~~~

在这里插入图片描述
在这里插入图片描述
5:询问是否安装:在这里插入图片描述6:输入

>> y

然后开始出现下图的趋势:在这里插入图片描述
-----done-------在这里插入图片描述
此时的Anaconda已经显示在更新新动态
打开Anaconda>>Environments 就可看到TensorFlow的选项:
表示TensorFlow的环境已经建好:
在这里插入图片描述
7:在Anaconda的启动TensorFlow:

activate tensorflow

在这里插入图片描述
8:安装cpu版本的TensorFlow

pip install --upgrade --ignore-installed tensorflow

响应结果如下图:

在这里插入图片描述

当不使用TensorFlow时,可以通过deactivate来关闭TensorFlow环境:

>> deactivate

9:测试cpu版本的TensorFlow:
先启动:activate tensorflow
再进入Python:python

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

python运行时:ModuleNotFoundError: No module named ‘tensorflow‘ 的相关文章

随机推荐

  • H5浏览器播放RTMP直播流

  • Python编程快速上手

    题目1 编写一个名为collatz 的函数 它有一个名为number的参数 如果参数是偶数 那么collatz 就打印出number 2 如果number是奇数 collatz 就打印3 number 1 def collatz numbe
  • 面试题 ⑥

    1 Java常见的线程池有哪些 它们的使用场景 newSingleThreadExecutor 创建一个单线程的线程池 此线程池保证所有的执行顺序按照任务的提交顺序执行 FIFO 适合顺序处理文件日志等 newFixedThreadPool
  • easyUI datagrid中checkbox选中事件以及行点击事件,翻页之后还可以选中

    DataGrid其中与选择 勾选相关 DataGrid属性 singleSelect boolean 如果为true 则只允许选择一行 false ctrlSelect boolean 在启用多行选择的时候允许使用Ctrl键 鼠标点击的方式
  • MySQL主从复制(Master-Slave)实践

    转载自 https www cnblogs com gl developer p 6170423 html 参考 https blog csdn net lildkdkdkjf article details 10004663 MySQL数
  • Python的pickle模块详解(包括优缺点及和JSON的区别)

    文章目录 一 pickle是什么 1 pickle的优缺点 2 pickle和JSON的区别 3 pickle的应用总结 二 pickle的用法 1 pickle接口 2 pickle实例 结语 一 pickle是什么 在英语中 pickl
  • 批处理一键关闭危险端口(135 137 138 139 445)预防勒索病毒

    一键关闭危险端口 bat echo off color 1f title 关闭常见的危险端口 echo 正在开启Windows防火墙 echo netsh advfirewall set currentprofile state on gt
  • 备份BOM T-SQL

    转载请注明出处 联系我 t39q 163 com 本人热衷于数据库技术及算法的研究 志同道合之士 欢迎探讨 ALTER PROC dbo proc BOM VersionAutoUpgrade company NVARCHAR 20 Par
  • input type=file选择图片按钮样式修改与图片预览

    1 背景 通过上图我们可以看到input type file按钮的默认样式 非常不美观 如果要自定义该按钮的样式 要如何实现呢 2 方式1样式 input覆盖整个按钮区域 并且设置完全透明
  • 图显系统DRM ENCODER和CONNECTOR完全解析

    0 引言 DRM ENCODER 和 CONNECTOR 模块由图显外设抽象而来 从传统意义上来讲 ENCODER 包含外设控制器的功能 而 CONNECTOR 包含外设 PHY 或者显示器参数 但是这两部分又紧密关联 因此 软件 DRM
  • 大神之路-起始篇

    欢迎关注 WeiyiGeek 作者 设为 星标 每天带你 基础入门 到 进阶实践 再到 放弃学习 涉及 网络安全运维 应用开发 物联网IOT 学习路径 个人感悟 等知识 花开堪折直须折 莫待无花空折枝 文章目录 第 4 部分 计算机软件与算
  • linux socket 开源库,libsocket

    README for libsocket BUILDING libsocket If you want to install both libsocket and libsocket simply use this command mkdi
  • 纯JS实现国家/省/市三级级联

    偷懒只加入了部分数据 HTML模块 div 国家 div
  • STM32F4时钟系统

    目录 1 STM32有5个时钟源 HSI HSE LSI LSE PLL 2 系统时钟SYSCLK可来源于三个时钟源 3 STM32F4时钟信号输出MC01 PA8 和MCO2 PC9 4 系统时钟初始化函数 SystemInit 1 ST
  • 存在隐患 : 3 racks are required for the erasure coding policies: RS-6-3-1024k. The number of racks is on

    刚装的CDH6 2 1版本的集群 172 30 81 203 manager 172 30 81 204 node1 172 30 81 205 node2 172 30 81 206 node3 存在隐患 9 DataNodes are
  • 安卓中高级开发面试知识点之——缓存

    几乎所有的项目都做了缓存 但是缓存做的怎么样 其实只有我们自己知道 缓存做的好 没有网络也能流畅的使用 再多的数据请求都不会出现卡顿延迟等待很久的情况 程序中除了图片缓存 三级缓存 还有信息缓存 当用户无法联网时 app会默认显示缓存的数据
  • 线速度和角速度

    转自 https baike baidu com item E7 BA BF E9 80 9F E5 BA A6 1532652 fr aladdin https baike baidu com item E8 A7 92 E9 80 9F
  • 人脸识别是最早走向实际应用的技术之一

    会员的刷脸消费 适合特殊场景下的消费 如健身俱乐部 夜店等无卡场所 目前 众多连锁超市 商城百货等多家医院 地铁都在普及刷脸支付 没有什么人和事可以随随便便成成功 商海战役亦如是 正因为刷脸支付给商家和消费者带来了如此多的便利和实惠 所以刷
  • (转)StyleCop

    微软的StyleCop作为一款代码分析插件 集成到Visual Studio 2008和Visual Studio 2010之中 可以帮助开发人员迅速地理清编程规范问题 对确保软件质量 确保软件开发效率而言 意义非凡 与同样出自微软的另一款
  • python运行时:ModuleNotFoundError: No module named ‘tensorflow‘

    TensorFlow报错 python或者anaconda运行时显示 一般的解决方案 pip install upgrade ignore installed tensorflow 或者 pip install user upgrade i