Ubuntu14.04安装Theano详细教程

转载 2016年06月01日 21:49:46

原文地址

http://blog.csdn.net/niuwei22007/article/details/47684673

因为最近需要学习深度学习,因此想要配置Theano,来开发深度学习算法。但是发现Theano安装总是出现问题。于是在这里中总结一下。

环境

  • 操作系统:ubuntu14.04
  • Python:2.7.6
  • 需要联网

相关库简介

  • BLAS(Basic Linear Algebra Subprograms)是基础线性代数子程序库,里面拥有大量已经编写好的关于线性代数运算的程序;
  • LAPACK (Linear Algebra PACKage)包含了求解科学与工程计算中最常见的数值线性代数问题,如求解线性方程组、线性最小二乘问题、特征值问题和奇异值问题等;
  • ATLAS是python下的一个线性代数库,是基于另外两个线性代数库BLAS和lapack的;
  • NumPy提供了一个在python中做科学计算的基础库,它重在数值计算,甚至可以说是用于多维数组处理的库;
  • SciPy是基于numpy,提供了一个在python中做科学计算的工具集,也就是说它是更上一个层次的库;
  • Theano则是基于NumPy以及SciPy的一个更高级的用于科学计算的库。

相关库的关系

  • 要安装Theano,就需要先安装好numpy和scipy;
  • 要安装numpy和scipy,就需要ATLAS;
  • 要安装ATLAS,就需要安装BLAS和LAPACK;

相关库的安装顺序

  • 安装顺序:BLAS → LAPACK → ATLAS → numpy → scipy → Theano

检查numpy和scipy是否通过测试

  • 说明:如果你的numpy和scipy是通过apt-get安装的,那么它们的单元测试可能会通不过!!!(我在安装过程中没有通过测试,scipy出现了Error
  • 如果numpy或scipy不能通过测试,就需要卸载,然后重新按照本文介绍的顺序安装。
<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 检查numpy是否通过测试</span>
python -c <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"import numpy;numpy.test()"</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
  • 如果numpy通过测试,会出现如下图所示的结果。注意最后一行errors=0 failures=0。如果没有通过测试,需要卸载并重新安装。 
    numpy测试结果

  • 如果scipy通过测试,会出现如下图所示的结果。注意最后一行errors=0 failures=0。如果没有通过测试,需要卸载并重新安装。 
    scipy通过测试

  • 注意:scipy很可能会出现测试错误,比如我安装过程中出现下图所示的错误。 
    scipy测试错误

卸载numpy和scipy

<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 卸载numpy</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get remove python-numpy

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 卸载scipy</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get remove python-scipy</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>

安装各种包

<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装gfortran,后面编译过程中会用到</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install gfortran
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装blas,Ubuntu下对应的是libopenblas,其它操作系统可能需要安装其它版本的blas——这是个OS相关的。</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install libopenblas-dev
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装lapack,Ubuntu下对应的是liblapack-dev,和OS相关。</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install liblapack-dev
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装atlas,Ubuntu下对应的是libatlas-base-dev,和OS相关。</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install libatlas-base-dev</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li></ul>

安装numpy和scipy

  • 使用pip安装numpy和scipy
  • 安装pip的命令:sudo apt-get install python-pip
  • 注意:一定要在安装完lapack/blas之后,再安装numpy和scipy。否则,会出现错误no lapack/blas resources found
  • 安装numpy和scipy的命令如下所示。
<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装numpy</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> pip install numpy
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 测试numpy</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 测试通过才能进行下一步~~</span>
python -c <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"import numpy;numpy.test()"</span>

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装scipy</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> pip install scipy
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 测试scipy</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 测试通过才能进行下一步~~</span>
python -c <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"import scipy;scipy.test()"</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li></ul>

安装线性计算库、numPy和sciPy的编译方法(推荐)

编译安装OpenBlas

<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">tar -zxvf OpenBLAS**.tar.gz
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">cd</span> OpenBLAS***
make -FC gfortran <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#需要已经安装gfortran </span>
make install <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装在/opt/OpenBLAS/目录下</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>

安装numPy

<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">tar -zxvf numpy***.tar.gz
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">cd</span> numpy***
cp site.cfg.example site.cfg
vi site.cfg
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#将以下4行去掉注释。【101行--104行】</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#[openblas]</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#libraries = openblas</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#library_dirs = /opt/OpenBLAS/lib</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#include_dirs = /opt/OpenBLAS/include</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>
  • 安装numPy。
<code class="hljs bash has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> python setup.py config
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> python setup.py build
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> python setup.py install </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>

安装sciPy

<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">tar -zxvf scipy***.tar.gz
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">cd</span> scipy***
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 将numPy**中的配置文件复制到此处</span>
cp ../numpy**/site.cfg.example ./site.cfg</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>
  • 安装sciPy。
<code class="hljs bash has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> python setup.py config
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> python setup.py build
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> python setup.py install </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>

安装其它库

  • 为了安装Theano,最后还需要安装一些库,可以参考官方教程
<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install python-dev
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install python-pip
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install python-nose
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install g++
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> apt-get install git 
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li></ul>

安装Theano

  • 前面的操作如果没有出现错误,就可以开始安装Theano了。命令如下所示。
<code class="language-bash hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 安装Theano</span>
<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">sudo</span> pip install Theano

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># 测试Theano</span>
python -c <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"import theano;theano.test()"</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>

引用


使用anaconda2的时候出现问题,测试numpy一直有错误

相关文章推荐

Ubuntu14.04安装Theano详细教程

本文转载自:http://blog.csdn.net/xuezhisdc/article/details/47065475 因为最近需要学习深度学习,因此想要配置Theano,来开发深度...

转载很经典的--Ubuntu14.04安装Theano详细教程

尊重原创:原文链接:http://blog.csdn.net/xuezhisdc/article/details/47065475 因为最近需要学习深度学习,因此想要配置Theano...

Ubuntu-安装-theano+caffe-超详细教程

##说明 * 本文是继《Ubuntu-安装-cuda7.0-单显卡-超详细教程》 之后的续篇。theano和caffe是深度学习库,对运算能力需求很大,最好使用cuda进行加速。所以,请先阅读《Ubu...

Ubuntu14.04安装与配置ROS Indigo 详细教程

1. 安装ROS 1.1 配置Ubuntu 软件源 在System Settings中将Software&Updates配置成: 1.2 设置软件源 sources.list 这里使用国内...

Ubuntu14.04 源代码安装 TensorFlow r0.12 详细教程

先甩一个TensorFlow的官方安装页面: TensorFlow download and setup先说说为什么要使用源代码安装吧TensorFlow有多种安装方式,最容易便捷也最少坑的安装方式...

Ubuntu 14.04 上安装 CUDA 7.5/8.0 超详细教程

折腾了好多天,前后重装了大概六、七次Ubuntu,终于上把CUDA安装好了,被坑了好多次,也走了不少弯路。 第一次发帖,还请多指教。【环境】 笔记本:ThinkPad T450 X8...

Win7系统下安装Ubuntu14.04超级详细图文教程

win7 64位系统,安装Ubuntu14.0的双系统,最详细的图文教程。Ubuntu系统分区时,主分区“/”,应放到最后在划分,否则会出现剩余空闲磁盘变成不可用状态。分区的大小,根据自己使用的情况划...

ubuntu14.04安装cuda7.5 详细教程

我的系统型号是ubuntu14.04.5 64位。电脑显卡是GTX850m,不知道为什么,安装cuda的自带驱动时总是提示 failed,自我感觉是因为cuda7.5自带的显卡驱动和我的显卡的型号不匹...

【图文绝对详细】Hadoop安装教程_单机/伪分布式配置_Hadoop2.6.0/Ubuntu14.04

dblab.xmu.edu.cn/blog/install-hadoop 原文作者: 给力星 你有多渴望,你有多付出 http://dblab.xmu.edu.cn/blog/install-had...
  • mmc2015
  • mmc2015
  • 2015年10月21日 22:59
  • 726

Ubuntu14.04+CUDA7.0+cuDNN_v4+theano+gpu

  • 2017年02月24日 13:02
  • 6KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Ubuntu14.04安装Theano详细教程
举报原因:
原因补充:

(最多只允许输入30个字)