第1章 TensorFlow基础学习
1.1 1)TensorFlow Python 库安装
1) pip install wheel
2) download tensorflow-.whl file
a)
b)
3) Install tensorflow
a) pip install tensorflow-1.head-py2-none-any.whl
b) pip install tensorflow-1.0.1-py2-none-any.whl
c) pip install --ignore-installed--upgrade (验证通过)
d)
4) 验证模块是否可以用
importtensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
b =tf.constant(100)
a = tf.constant(200)
printsess.run(a+b)
1.2 Win10 安装tensorflow
1) 安装Python3.5 ,匹配CP35版本的TensorFlow
2) 安装vc2015 版本
3) 工具下载
a)
b)
4) 安装tensorflow
a) pip install --upgrade
5)
1.3 Tensorboard可视化训练UI
1)TensorBoard 服务
tensorboardhttp://192.168.6.52:8080 --logdir='/var/log/'
1.4 安装遇到问题
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import tensorflowTraceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File " ", line 969, in _find_and_load File " ", line 958, in _find_and_load_unlocked File " ", line 666, in _load_unlocked File " ", line 577, in module_from_spec File " ", line 914, in create_module File " ", line 222, in _call_with_frames_removedImportError: DLL load failed: 找不到指定的模块。During handling of the above exception, another exception occurred:Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 54, in from tensorflow.python import pywrap_tensorflow File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in _pywrap_tensorflow = swig_import_helper() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper return importlib.import_module('_pywrap_tensorflow') File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module return _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 " ", line 1, in File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in from tensorflow.python import * File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 60, in raise ImportError(msg)ImportError: Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File " ", line 986, in _gcd_import File " ", line 969, in _find_and_load File " ", line 958, in _find_and_load_unlocked File " ", line 666, in _load_unlocked File " ", line 577, in module_from_spec File " ", line 914, in create_module File " ", line 222, in _call_with_frames_removedImportError: DLL load failed: 找不到指定的模块。During handling of the above exception, another exception occurred:Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 54, in from tensorflow.python import pywrap_tensorflow File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in _pywrap_tensorflow = swig_import_helper() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper return importlib.import_module('_pywrap_tensorflow') File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)ImportError: No module named '_pywrap_tensorflow'Error importing tensorflow. Unless you are using bazel,you should not try to import tensorflow from its source directory;please exit the tensorflow source tree, and relaunch your python interpreterfrom there.
解决办法:
1)ImportError: No module named '_pywrap_tensorflow'
a)Download : https://download.microsoft.com/download/6/D/F/6DF3FF94-F7F9-4F0B-838C-A328D1A7D0EE/vc_redist.x64.exe
b)安装vc_redist.x64.exe
2)Import tensorflow