安装TensorFlow-gpu
来源:互联网 发布:凯云水利软件 编辑:程序博客网 时间:2024/06/15 16:01
最近按照官网教程安装tensorflow-gpu版本时,遇到了一些问题,花了点时间,在这里总结下安装的步骤,希望对大家有所帮助.
首先说明下我的环境:
- 操作系统 win10
- 显卡 Nvidia GeForce 1060 ,提这个的原因是我需要安装GPU的支持
下面介绍下详细的安装步骤
一、添加显卡支持
- 下载并安装 CUDA Toolkit
CUDA Toolkit 下载地址: https://developer.nvidia.com/cuda-downloads ,版本至少得8.0以上
按照安装程序默认安装即可,默认目录: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
- 下载并安装 cuDNN
cuDNN 下载地址: https://developer.nvidia.com/cudnn, 版本为 5.1(非常重要,必须为5.1,当时我安装时没注意看,安装了6.0,结果导致了以下的错误)
C:\Users\test\Desktop>>python firstp.pyTraceback (most recent call last):File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helperreturn importlib.import_module(mname)File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_init_.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)File "", line 986, in _gcd_importFile "", line 969, in _find_and_loadFile "", line 958, in _find_and_load_unlockedFile "", line 666, in _load_unlockedFile "", line 577, in module_from_specFile "", line 906, in create_moduleFile "", line 222, in _call_with_frames_removedImportError: DLL load failed: The specified module could not be found.During handling of the above exception, another exception occurred:Traceback (most recent call last):File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python_init_.py", line 66, in from tensorflow.python import pywrap_tensorflowFile "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in _pywrap_tensorflow = swig_import_helper()File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helperreturn importlib.import_module('pywrap_tensorflow')File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_init.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)ImportError: No module named '_pywrap_tensorflow'During handling of the above exception, another exception occurred:Traceback (most recent call last):File "C:\Users\test\Desktop\firstp.py", line 1, in import tensorflow as tfFile "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow_init_.py", line 24, in from tensorflow.python import *File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python_init_.py", line 72, in raise ImportError(msg)ImportError: Traceback (most recent call last):File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helperreturn importlib.import_module(mname)File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_init_.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)File "", line 986, in _gcd_importFile "", line 969, in _find_and_loadFile "", line 958, in _find_and_load_unlockedFile "", line 666, in _load_unlockedFile "", line 577, in module_from_specFile "", line 906, in create_moduleFile "", line 222, in _call_with_frames_removedImportError: DLL load failed: The specified module could not be found.During handling of the above exception, another exception occurred:Traceback (most recent call last):File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python_init_.py", line 66, in from tensorflow.python import pywrap_tensorflowFile "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in _pywrap_tensorflow = swig_import_helper()File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helperreturn importlib.import_module('pywrap_tensorflow')File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_init.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)ImportError: No module named '_pywrap_tensorflow'
接下来需要配置环境变量,默认情况下,安装程序会在系统环境变量中自动注册以下两个变量:
我们还需手动修改环境变量Path,并添加以下两个变量值:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64
最后的效果应该如下:
系统变量
Path
接下来就是正式安装了,我是通过Anaconda的方式安装的,所以第一步得先安装Anaconda,下载地址: Anaconda
安装完后,我们执行以下的命令安装 python:
conda create -n tensorflow python=3.5.2
下一步,通过Anaconda激活我们安装的Python,并安装 tensorflow-gpu:
activate tensorflowpip install tensorflow-gpu
最后,我们来验证一下安装是否成功:
activate tensorflowpythonimport tensorflow as tfhello = tf.constant('Hello, TensorFlow!')sess = tf.Session()print(sess.run(hello))
如果一切正常,你将看到以下的输出:
Hello, TensorFlow!
到这里,我们已经成功的安装了TensorFlow,本次教程也到此为止。
阅读全文
0 0
- 安装windows tensorflow-gpu
- Tensorflow gpu 安装
- TensorFlow(GPU) 安装
- TensorFlow GPU版安装
- Win10安装gpu-tensorflow
- 安装TensorFlow-gpu
- 安装TensorFlow with GPU
- Windows安装TensorFlow-GPU
- tensorflow-gpu安装
- TensorFlow GPU安装
- Windows Tensorflow GPU安装
- Win10 安装Tensorflow-GPU版本
- win10 安装 tensorflow gpu 版
- Windows10安装TensorFlow GPU版本
- ubuntu14.04+GPU安装TensorFlow
- Windows下安装TensorFlow-gpu
- Windows安装TensorFlow(CPU/GPU)
- Windows10安装GPU版Tensorflow
- ElasticSearch启动报错,常规解决方法
- hiho1542无根数变有根树水题
- HDU6035 Colorful Tree
- 遇见问题解决步骤
- bzoj 1001
- 安装TensorFlow-gpu
- Eclipse导入Maven项目详解(新手初学)
- C语言的C89标准与C99标准
- 数据结构4:链表专题
- 如何提取图片的所有像素的颜色RGBa值?
- cocos2d-x-3.2 打包Apk
- 差分放大电路四种接法的性能比较
- 解决MySQL不允许(其它IP)从远程访问的方法
- java基础之java内存模型