在prompt端输入:
需要提前安装以下包:
conda install numpy scipy
安装 theano
pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
安装 lasagne
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip
如果直接 conda install lasagne,那么多半会出现以下问题:
You can find the C code in this temporary file: c:\users\54719\appdata\local\temp\theano_compilation_error_5qddr3
library blas is not found
。。。
Exception: (‘The following error happened while compiling the node’, Dot22(<TensorType(float64, matrix)>, W), ‘\n’, 'Compilation failed (return status=1): D:/Anaconda3/envs/python27/Library/mingw-w64/bin/…/lib/gcc/x86_64-w64-mingw32/5.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: cannot find -lblas\r. collect2.exe: error: ld returned 1 exit status\r. ',
这是因为theano有三种运行方式–依托于numpy的mkl、cpu(g++)、gpu,用conda安装theano时,会默认把m2w64-toolchain(包含g++)装上,导致不能在numpy上运行。
解决办法
为了成功让运行g++提速,我们要:
#没安装过m2w64-toolchain的请把那个也安装下
conda install mingw libpython
在c:\users\54719\找到.theanorc.txt,这个文件,把里面的內容修改成:
[global]
openmp=False
[blas]
ldflags =
[gcc]
cxxflags = -ID:\Anaconda3\envs\last\MinGW
(MinGW包在D:\Anaconda3\envs\last\MinGW里)
然后就好了
如果想要gpu加速,请参阅:https://blog.csdn.net/deepstem/article/details/77170109