tensorflowwindows安装
1.在python官网下载3.5 64位版本的python,并进行安装
2.进行安装,配置环境变量
3.命令行执行pip3 install numpy
4.命令行执行pip3 install tensorflow
5.运行测试
将以下代码保存到test.py中,然后通过python test.py运行
import tensorflow as tf
import numpy as np x_data = np.random.rand(100).astype(np.float32)
y_data = x_data*0.1 + 0.3 Weights = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
biases = tf.Variable(tf.zeros([1])) y = Weights*x_data + biases loss = tf.reduce_mean(tf.square(y-y_data)) optimizer = tf.train.GradientDescentOptimizer(0.5)
train = optimizer.minimize(loss) init = tf.global_variables_initializer() sess = tf.Session()
sess.run(init) for step in range(201):
sess.run(train)
if step % 20 == 0:
print(step, sess.run(Weights), sess.run(biases))
运行结果(我们计算 x*0.1+0.3=y tensorflow通过x与y的值,逼近0.1和0.3)
0 [-0.03866833] [ 0.56909722]
20 [ 0.0400503] [ 0.33504695]
40 [ 0.08370772] [ 0.30952457]
60 [ 0.09557232] [ 0.30258846]
80 [ 0.09879671] [ 0.30070347]
100 [ 0.099673] [ 0.30019119]
120 [ 0.09991115] [ 0.30005196]
140 [ 0.09997585] [ 0.30001414]
160 [ 0.09999346] [ 0.30000383]
180 [ 0.09999823] [ 0.30000106]
200 [ 0.09999952] [ 0.30000031]
6.如果出现报错,则安装搜索Microsoft Visual C++ 2015 Redistributable Update 3安装
https://www.microsoft.com/zh-CN/download/details.aspx?id=52685
Traceback (most recent call last):
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in swig_import_helper
return importlib.import_module(mname)
File "D:\Python35\lib\importlib\__init__.py", line , in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line , in _gcd_import
File "<frozen importlib._bootstrap>", line , in _find_and_load
File "<frozen importlib._bootstrap>", line , in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line , in _load_unlocked
File "<frozen importlib._bootstrap>", line , in module_from_spec
File "<frozen importlib._bootstrap_external>", line , in create_module
File "<frozen importlib._bootstrap>", line , in _call_with_frames_removed
ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line , in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "D:\Python35\lib\importlib\__init__.py", line , in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal' During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "test.py", line , in <module>
import tensorflow as tf
File "D:\Python35\lib\site-packages\tensorflow\__init__.py", line , in <module>
from tensorflow.python import *
File "D:\Python35\lib\site-packages\tensorflow\python\__init__.py", line , in <module>
from tensorflow.python import pywrap_tensorflow
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line , in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in swig_import_helper
return importlib.import_module(mname)
File "D:\Python35\lib\importlib\__init__.py", line , in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line , in _gcd_import
File "<frozen importlib._bootstrap>", line , in _find_and_load
File "<frozen importlib._bootstrap>", line , in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line , in _load_unlocked
File "<frozen importlib._bootstrap>", line , in module_from_spec
File "<frozen importlib._bootstrap_external>", line , in create_module
File "<frozen importlib._bootstrap>", line , in _call_with_frames_removed
ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line , in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line , in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "D:\Python35\lib\importlib\__init__.py", line , in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: 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.
tensorflowwindows安装的更多相关文章
- tensorflow-windows下安装,python3.6
安装: pip install tensorflow ps:我第一次安装了,但是导入却失败了. 进入\python3\Lib\site-packages\删除了tensorflow,再次pip ins ...
- 【TensorFlow-windows】(零)TensorFlow的"安装"
Tensorflow的安装,具体操作就不演示了.具体操作请移步: http://blog.csdn.net/darlingwood2013/article/details/60322258#comme ...
- docker——容器安装tomcat
写在前面: 继续docker的学习,学习了docker的基本常用命令之后,我在docker上安装jdk,tomcat两个基本的java web工具,这里对操作流程记录一下. 软件准备: 1.jdk-7 ...
- 网络原因导致 npm 软件包 node-sass / gulp-sass 安装失败的处理办法
如果你正在构建一个基于 gulp 的前端自动化开发环境,那么极有可能会用到 gulp-sass ,由于网络原因你可能会安装失败,因为安装过程中部分细节会到亚马逊云服务器上获取文件.本文主要讨论在不变更 ...
- Sublime Text3安装JsHint
介绍 Sublime Text3使用jshint依赖Nodejs,SublimeLinter和Sublimelinter-jshint. NodeJs的安装省略. 安装SublimeLinter Su ...
- Fabio 安装和简单使用
Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...
- gentoo 安装
加载完光驱后 1进行ping命令查看网络是否通畅 2设置硬盘的标识为GPT(主要用于64位且启动模式为UEFI,还有一个是MBR,主要用于32位且启动模式为bois) parted -a optima ...
- Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级
Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 5.安装Database软件 5. ...
- Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作
Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 1.实施前准备工作 1.1 服务器安装操 ...
随机推荐
- HTML:meta标签使用总结 [转载] [360浏览器 指定极速模式]
meta标签作用 META标签是HTML标记HEAD区的一个关键标签,提供文档字符集.使用语言.作者等基本信息,以及对关键词和网页等级的设定等,最大的作用是能够做搜索引擎优化(SEO). PS:便于搜 ...
- 大数据时代——为什么用HADOOP?
转载自:http://www.daniubiji.cn/archives/538 什么叫大数据 “大”,说的并不仅是数据的“多”!不能用数据到了多少TB ,多少PB 来说. 对于大数据,可以用四个词来 ...
- Mysql索引分类和索引优化
一. MySQL: 索引以B树格式保存 Memory存储引擎可以选择Hash或BTree索引,Hash索引只能用于=或<=>的等式比较. 1.普通索引:create index on Ta ...
- 批处理手动设置电脑的ip
参考: http://blog.csdn.net/jiangzhanchang/article/details/7063152 http://wenda.haosou.com/q/1378697364 ...
- SDRAM读写操作
SDRAM读写操作 1.读操作 2.写操作 SDRAM所有时序参数都可以在芯片手册上查到.
- ThreadingTCPServer 如何设置端口重用
一个典型的TCPServer的建立 #ThreadingTCPServer从ThreadingMixIn和TCPServer继承 #class ThreadingTCPServer(Threading ...
- 持续集成之Jenkins+Gitlab实现持续集成 [二]
持续集成之Jenkins+Gitlab实现持续集成 [二] 项目:使用git+jenkins实现持续集成 开始构建 General 源码管理 我们安装的是Git插件,还可以安装svn插件 我们将 ...
- NDK学习笔记(二)
花了点时间把pixeliop的部分看完了,拿到开发文档提供的案例稍事修改,把画面左半边压暗. 这个案例重点在于理清pixel_engine()函数中的坐标与scanline的关系. y代表当前正在调用 ...
- WebService发布到IIS
发布WebService 第一步:选择项目右键发布 第二步:选择文件系统.目标位置(即,发布后文件保存位置) 单击发布 将WebService发布至IIS 第一步:打开IIS 右键添加网站--填写网站 ...
- python 类继承与子类实例初始化
From: https://blog.csdn.net/cs0301lm/article/details/6002504?utm_source=blogxgwz4 [ 先贴参考书籍原文(中文英文对照) ...