博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
windows 10 64bit下安装Tensorflow+Keras
阅读量:6940 次
发布时间:2019-06-27

本文共 4728 字,大约阅读时间需要 15 分钟。

windows 10 下 pip,conda 换国内源,安装Tensorflow,Keras

修改pip源 参考

官方文档

windows 全部用户需要在%APPDATA%\pip\pip.ini,当前用户在%HOME%\pip\pip.ini

[global]index-url=http://mirrors.aliyun.com/pypi/simple/[install]trusted-host=mirrors.aliyun.com复制代码

安装Tensorflow

参考

# 切换到 python3.5 参考 详见另外一篇博文 https://anjia.ml/2017/07/02/anaconda-install-and-configurating-jupyter/#切换python版本#打开Anaconda Prompt(python35) C:\Users\xx> activate python35#因为电脑无独显,所以安装`CPU-only`版本(python35) C:\Users\xx> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.1-cp35-cp35m-win_amd64.whl (python35) C:\Users\xx>python复制代码
>>> import tensorflow as tf>>> hello = tf.constant('Hello, TensorFlow')>>> sess = tf.Session()2017-07-03 16:44:16.082952: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.2017-07-03 16:44:16.085175: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.2017-07-03 16:44:16.085590: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.2017-07-03 16:44:16.085952: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.2017-07-03 16:44:16.086312: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.2017-07-03 16:44:16.086634: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.2017-07-03 16:44:16.087014: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.2017-07-03 16:44:16.087363: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.>>> print(sess.run(hello))b'Hello, TensorFlow'复制代码

如果要去掉4-12的警告信息,需要自己编译。详见

安装Keras

参考 官方文档 中文文档

(python35) C:\Users\xx>pip install keras -U --pre复制代码

但是我安装一直报错,

Running setup.py bdist_wheel for scipy ... error  Complete output from command {Anaconda3_home}\envs\python35\python.exe -u -c "import setuptools, tokenize;__file__='{AppData}\\Local\\Temp\\pip-build-mgdjtt1d\\scipy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d {AppData}\Local\Temp\tmpb_od_dlvpip-wheel- --python-tag cp35:  lapack_opt_info:  lapack_mkl_info:    libraries mkl_rt not found in ['{Anaconda3_home}\\envs\\python35\\lib', 'C:\\', '{Anaconda3_home}\\envs\\python35\\libs']    NOT AVAILABLE## ...Command "{Anaconda3_home}\envs\python35\python.exe -u -c "import setuptools, tokenize;__file__='{AppData}\\Local\\Temp\\pip-build-mgdjtt1d\\scipy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record {AppData}\Local\Temp\pip-htcraop7-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in {AppData}\Local\Temp\pip-build-mgdjtt1d\scipy\复制代码

网上有建议通过 pip install git+git://github.com/Theano/Theano.git 从github直接下最新代码安装的,但是也是安装失败

我成功的方式

(python35) C:\Users\xx>conda install mingw libpython theano -y(python35) C:\Users\xx>pip install keras复制代码

天朝网络不稳定,挺慢的,可以参考 另外一篇博文切换清华源

(python35) C:\Users\xx>pythonPython 3.5.3 |Continuum Analytics, Inc.| (default, May 15 2017, 10:43:23) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import kerasUsing TensorFlow backend.复制代码

安装成功,默认后端是TensorFlow

博客

掘金
简书

转载地址:http://fginl.baihongyu.com/

你可能感兴趣的文章
/var/目录下文件详解
查看>>
敏捷活动中的系统思考
查看>>
我的友情链接
查看>>
CentOS6.2+Kerio MailServer开源企业级邮件服务器
查看>>
做个阶段性总结[2012/10/21]
查看>>
Part07 - (图文)NSX系列之检查ESXi主机上VIBs的完整性
查看>>
【223期推荐】最有前途HIT系统评选,区域与EMR成热门!
查看>>
pyhton实现翻译
查看>>
ManagementEventWatcher and System.Management
查看>>
ssh远程控制软件的应用
查看>>
【转载】小卡片,大能量
查看>>
cocos2dx 暴露c++函数给lua
查看>>
firebug “阻挡”
查看>>
创新or抄袭?仿苹果OS开源Pear Linux体验(1)
查看>>
mysql配置讲解
查看>>
DRBD+HeartBeat+NFS 搭建高可用文件共享服务器笔记
查看>>
web数据同步的四种方式
查看>>
拼音输入法雏形原理
查看>>
自动打包备份压缩常用的脚步
查看>>
varnish优化
查看>>