hello tensorflow
安装tensorflow
-
这段时间可能要进深度学习的坑;以前没有弄过,打算从基础的demo学起。
-
开始学习深度学习的框架tensorflow;由于caffe安装很复杂,然后现在别人说也没有维护了,加之tensorflow现在支持window了;今天就开始安装试试。
-
网上有很多教程,说白了还是官方的文档给力:Installing TensorFlow on Windows
-
首先以前的python安装的是2.7的;然后直接又安装了3.5python,当然也安装了 Anacond。
-
坑啊,自己用其他的python版本,如3.6等都不行,用3.5.3才行
Installing with native pip
If the following version of Python is not installed on your machine, install it now:
Python 3.5.x from python.org
TensorFlow only supports version 3.5.x of Python on Windows. Note that Python 3.5.x comes with the pip3 package manager, which is the program you'll use to install TensorFlow.
To install TensorFlow, start a terminal. Then issue the appropriate pip3 install command in that terminal. To install the CPU-only version of TensorFlow, enter the following command:
C:\> pip3 install --upgrade tensorflow
Anaconda的方法,所以用spyder就用这种方法
Installing with Anaconda
The Anaconda installation is community supported, not officially supported.
Take the following steps to install TensorFlow in an Anaconda environment:
Follow the instructions on the Anaconda download site to download and install Anaconda.
Create a conda environment named tensorflow by invoking the following command:
C:> conda create -n tensorflow
Activate the conda environment by issuing the following command:
C:> activate tensorflow
(tensorflow)C:> # Your prompt should change
Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command:
(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
To install the GPU version of TensorFlow, enter the following command (on a single line):
遇到的问题
- 按网上的教程都是这样写,但是有错;后面改成pip3就可以啦;对了自己还用了天行vpn,不知道有没有影响
>>> pip install tensorflow
SyntaxError: invalid syntax
- 安装完成如下图:
hello tensorflow
-
直接在spyder上测试错误,没有tensorflow包;原因是Anacond自带的python库路径和tensorflow的实际安装位置不一致。
-
最后用python3.5自带的shell测试成功,如下图:
后续学习
-
打算从基础的识别手写数字(MNIST)学习
-
参考:经典入门demo:识别手写数字(MNIST) 阿里云社区的
reference
C/C++基本语法学习
STL
C++ primer