码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 解决conda环境下import TensorFlow失败的问题


    问题描述

    安装了anaconda的电脑,新建了一个名叫deeplearning的环境,在该环境下已经成功安装了tensorflow。
    于是在终端打开python并执行代码

    import tensorflow as tf
    print(1)
    
    • 1
    • 2

    除了提示

    2024-02-27 21:50:00.801427: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
    2024-02-27 21:50:00.838675: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
    2024-02-27 21:50:00.838709: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
    2024-02-27 21:50:00.839681: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
    2024-02-27 21:50:00.845214: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used.
    2024-02-27 21:50:00.845380: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
    To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
    2024-02-27 21:50:01.529134: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
    1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    错误提示是代表没有安装TensorRT,暂时忽略,可以看出已经打印了1,已经安装成功。
    但是运行juypter-notebook后,会提示

    ModuleNotFoundError: No module named 'tensorflow'
    
    • 1

    原因

    在新建环境下,没有安装juypter-notebook,导致运行的juypter-notebook实际上仍然是base环境下的,因此失败

    解决

    conda activate deeplearning
    conda install nb_conda
    
    • 1
    • 2

    这样就在deeplearning安装了juypter-notebook了。
    问题解决。

  • 相关阅读:
    vue3.0实战项目
    【吴恩达机器学习-笔记整理】SVM-支持向量机(新的代价函数,最大间隔,高斯核函数,特征数与样本数不同大小关系时的选择)
    什么样的性能测试工具才算是好的工具呢?
    基本数据类型
    Java注释:类、方法和字段注释
    你们公司每次迭代周期多久?加班多么?
    基于VUE + Echarts 实现可视化数据大屏环保可视化
    2022-08-27 第五组 张明敏 学习笔记
    Git存储原理——树对象
    消费与储蓄的决定-中国视角下的宏观经济
  • 原文地址:https://blog.csdn.net/weixin_42156097/article/details/136332969
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号