TensorFlow及Keras环境搭建

1.python版本为Python 3.7.6

2.主要参考这一篇文章,很详细

3.为防止参考失效,这里补充一下

版本

tensorflow1.15

pip install keras==2.3.1

安装之前升级 pip和numpy和virtualenv

检查tensorflow安装是否成功

>>> import numpy
>>> numpy.__version__
'1.19.1'
>>> import tensorflow as tf
2020-10-29 21:03:29.426564: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-10-29 21:03:29.438847: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
>>> print(tf.__version__)
1.15.0
>>> hello=tf.constant('Hello,TensorFlow!')
>>> sess=tf.Session()
2020-10-29 21:04:27.150051: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-10-29 21:04:27.153995: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
2020-10-29 21:04:27.257908: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: USER-PC
2020-10-29 21:04:27.262164: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: USER-PC
2020-10-29 21:04:27.277681: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
>>> print(sess.run(hello))
b'Hello,TensorFlow!'
>>>

 检查keras是否安装成功

>>> import keras
Using TensorFlow backend.
>>> keras.__version__
'2.3.1'
>>>

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cc_sensii

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值