tensorflow安装教程总结

提示:cpu版本不用安装cuda,gpu版本需要。

官网教程:

使用 pip 安装 TensorFlow

博文总结:

TensorFlow的两种不同安装方法(亲测有效)_如何安装tensorflow1.0_城市明月的博客-CSDN博客

教你如何在Ubuntu 18.04 下安装 Tensorflow(CPU)_chuche1931的博客-CSDN博客

 Ubantu 18.04 安装 TensorFlow 详细教程_tensorflow ubuntu18_ViatorSun的博客-CSDN博客

总结:虚拟机可以安装cpu版本,tensorflow版本要和python版本相对应。

各种原因安装过程一言难尽

        下载的python3.6,但使用pip install --upgrade tensorflow直接安装,提示要安装python3.7以上版本,下载了3.6版本对应的tensorflow没安装上,具体原因忘了,之后安装python3.7,然后导致系统里有2.7 3.6 3.7三个版本,后续出了一系列问题。

错误1:只要使用pip就会出现以下提示

WARNING: pip is being invoked by an old script wrapper.

            解决:在使用pip时前面加上python -m强制执行(下面这个语句是重新强制安装pip的例子)。

python -m pip install --upgrade --force-reinstall pip 

             博文

更新pip后出现WARNING:pip is being invoked by an old script wrapper_gogottt的博客-CSDN博客

WARNING: pip is being invoked by an old script wrapper._NEFU AB-IN的博客-CSDN博客

错误2:总结就是包放的地方不对,需要增加权限才能使用

Python:Defaulting to user installation because normal 
site-packages is not writeable

             解决:加上--user

pip install --user <package-name> #使用user权限

             博文(还有其他方法,博主还未尝试):

Python:Defaulting to user installation because normal site-packages is not writeable - 知乎

错误3

[mcj]subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned
 non-zero exit status 1

              解决

find -name / lsb_release

rm -rf /user/bin/lsb_release

               博文

subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1._兔姐的博客-CSDN博客

重点:安装tensorflow原代码为:  

pip install --upgrade tensorflow

              经过各种错乱后改成可运行的新代码

python -m pip install --user --upgrade tensorflow

              补充一个tensorflow下载技巧,加入下载源-i https://pypi.tuna.tsinghua.edu.cn/simple/

python -m pip install --user -i https://pypi.tuna.tsinghua.edu.cn/simple/ --upgrade tensorflow

                博文

虚拟机VMware的Ubuntu下安装tensorflow详解









 

千辛万苦安装完成后,测试是否安装成功,又出现了新的问题。

错误1:输入测试代码:import tensorflow as tf,错误提示含义(表明 CPU 支持AVX AVX2 (可以加速CPU计算),但是你安装的 TensorFlow 版本不支持。

2023-06-24 17:44:00.550500: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is op
timized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance
-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

               解决:可以选择忽略也可以选择重装相对应的版本。

               博文TensorFlow 未使用高级 CPU 指令,CPU存在警告:I tensorflow/core/platform/cpu_feature_guard.cc:193] I tensorflow/._落花雨96的博客-CSDN博客

错误2:tensorflow和cuda版本不对应,博主是没下载cuda

Coul
d not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: N
o such file or directory

               解决:下载相应版本cuda

               博文

上验证cudnn是否安装成功_ubuntu18.04 安装cuda、cudnn、tensorflow和pytorch其实很简单...

tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudart_~~Jerry~~的博客-CSDN博客

错误3: 输入sess = tf.Session()。错误的意思是tensortflow2.0模块没有Session属性。

tensorflow使用Session模块时报错:AttributeError: module ‘tensorflow
‘ has no attribute ‘Session‘,已解决

            解决:将tf.Session()更改为 tf.compat.v1.disable_eager_execution()

            博文tensorflow使用Session模块时报错:AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘,已解决_tensorflow session报错_UCAS2019的博客-CSDN博客

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值