台式机Win10,GPU:GTX750以及CPU:i5 750安装tensorflow-gpu版

1.安装Anaconda

2.安装Pycham

3.安装CUDA 9.0

下载地址:点击此链接
在这里插入图片描述

4.下载cuDNN 7.3 for CUDA 9

下载地址:点击此链接
点击

5.建立tensorflow-gpu环境

5.1 打开Anaconda Prompt

输入conda create -n tensorflow_gpu python=3.6 并回车
在这里插入图片描述
其中tensorflow_gpu只是环境名,取别的也没关系,只是后期使用该环境时你要记得这个环境是安装了哪些模块

输入y并回车
在这里插入图片描述

5.2 激活tensorflow_gpu

输入 activate tensorflow_gpu 回车
在这里插入图片描述

5.3 下载gpu版的tensorflow模块(版本1.5.0)

输入 pip install --default-timeout=100 --ignore-installed --upgrade tensorflow-gpu==1.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple 回车,等待其安装完
更多pip安装代码和conda环境管理代码可查看我的另一篇博客
在这里插入图片描述
由于博主的CPU型号太老,因此需要安装1.5.0版的tensorflow ,安装1.5.0以上的会报错

当我安装完成后出现如下
在这里插入图片描述

5.4 测试是否安装成功

输入 python 进入python编辑环境内
在这里插入图片描述
依次输入
import tensorflow as tf
hello=tf.constant(‘hello,world’)
sess=tf.Session()
print(sess.run(hello))
并回车,中间可能会有些警告,但不出现红色错误就没啥事

最终出现下图即可
在这里插入图片描述
继续输入exit()退出python环境

PS 如果博主的机子安装1.5.0以上版本tensorflow

那么在import tensorflow会出现以下报错

Traceback (most recent call last):
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 18, in swig_import_helper
return importlib.import_module(mname)
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\importlib_init_.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal’)
File "C:\Users\hongc\anaconda3\envs\tensorflow\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow_init_.py”, line 24, in
from tensorflow.python import *
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python_init_.py”, line 49, in
from tensorflow.python import pywrap_tensorflow
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 18, in swig_import_helper
return importlib.import_module(mname)
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\importlib_init_.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\hongc\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal’)
File "C:\Users\hongc\anaconda3\envs\tensorflow\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值