【转载】Theano Windows 中文安装指南
Theano Windows 中文安装指南(Chinese Installation Guidance )
Pages 15
Clone this wiki locally
Clone in DesktopTheano 中文安装指南
安装前准备:
-
安装MinGW并升级gcc, 有可能需要更新gcc到4.7.x 或者以上的版本来避免一些编译错误, 如果需要更新可以打开MinGW后使用下列命令更新.
% mingw-get update% mingw-get upgrade gcc# this is also needed or you it will not find cc1plus.exe% mingw-get upgrade g++# we also need Fortran for building BLASmingw-get install gcc-fortran -
安装Python Distribution(Python Distribution是集成了诸多依赖包的Python版本), 若不想安装此部分, 请看步骤三:
- 推荐安装AnacondaCE
- 其他选择:Enthought Python Distribution (EPD)/Canopy
(如果你拥有一定的支付能力可购买Commercial版本或者凭身份获取免费的Academic版本证书)
-
如果没有安装以上Distribution, 请安装如下软件:
安装Theano
-
基础发行版本安装:
pip install theano -
最新版本安装:(需要git)
# Use Git Bash Shellgit clone git://github.com/Theano/Theano.git
并且将Theano的文件夹目录添加(或编辑)到PYTHONPATH 环境变量中去, 并且重启命令行窗口, 使用如下命令查看是否安装成功:Return Theano DirectoryC:\Users\login>echo %PYTHONPATH% -
然后在你的根目录(e.g., C:\Users<you>), 创建一个叫做.theanorc(或者.theanorc.txt)文件, 并编辑其内容为:
[blas]ldflags =# ldflags = -lopenblas # placeholder for openblas support
如果在运行Theano的时候产生error: ‘assert’ was not declared in this scope, 则需要再添加如下内容:[gcc]cxxflags = -IC:\MinGW\include
使用GPU(仅在Visual Studio 下运行):
- 安装Cuda:
- CUDA 6.5 (32-bit on 32-bit Windows, 64-bit on 64-bit Windows).
- 可选: The CUDA GPU Computing SDK (32-bit/64-bit matches your python ).
-
安装Visual Studio(或者Visual C++)
-
根据Nvidia 网站的CUDA Getting Started Guide, 利用Visual Studio编译Cuda代码. (如果这一步没有成功, Theano将可能不能编译GPU代码).
-
编辑Theano的配置文件, 添加如下内容:(具体内容应当对应你的Python版本和VS版本做适当修改)
[nvcc]flags=-LC:\Python26\libscompiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin -
使用Visual Studio命令行工具(在“Visual Studio Tools”文件夹下). 在Python中运行"import theano.sandbox.cuda". 将会编译第一个Cuda文件, 并且没有错误产生.
简单测试GPU计算: 首先编辑Theano的配置文件:[global]device = gpufloatX = float32
然后运行theano/misc/check_blas.py测试文件. -
相关推荐: PyCuda, OpenCL

浙公网安备 33010602011771号