热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

台式机Win10,GPU:GTX750以及CPU:i5750安装tensorflowgpu版

1.安装Anaconda2.安装Pycham3.安装CUDA9.0下载地址:点击此链接4.下载cuDNN7.3forCUDA9下载地址:点击此链接5.建立tensorflow-gp


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.



推荐阅读
author-avatar
杀你哥_52544
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有