我安装了Anaconda . 现在我想在Anaconda中安装Theano库 . 我试过了:
-
Anaconda的Theano安装程序来自http://deeplearning.net/software/theano/install.html#windows-installer-for-anacondace,但它引发错误"The installer could not find a version of Anaconda installed. Please download and install Anaconda CE" . 我已将〜/ anaconda3,〜/ anaconda3 / scripts添加到环境变量路径中 .
-
我试图通过构建Stack Overflow,How do I keep track of pip-installed packages in an Anaconda (Conda) environment?中提到的包来安装它,但是在测试包时这也失败了 . 错误截图如下:
我甚至安装了Python ver . 3.4,使用pip install安装Theano,当我尝试导入Theano时,它给出了类似于屏幕截图中的错误的错误 . 我尝试了这个Google Groups讨论中提到的变化,但是没有运气 .
3 回答
在Python 3.4上运行Theano很复杂 . 到目前为止,我建议你在Python 2.7中运行Theano . 为Theano编写的库是基于Python 2.6的 . 因此,为了让Theano在Python 3.4中运行,您将需要2to3自动python 2到3代码转换工具 . 我没有使用2to3测试Theano,所以我不能评论它是否会起作用 . 但是,我正在使用Python 2.7并且Theano工作顺利 . 此外,您可能希望将AnacondaCE与Python 2.7安装程序一起使用,它几乎为您提供了开始开发所需的一切 .
您还需要重新安装Theano
我们可以看到,你试图在Windows下使用Theano . 请确保您有一个MinGW编译器 . 此外,确保您有MinGW和libpython包 .
一般来说,我建议使用答案How do I install Keras and Theano in Anaconda Python 2.7 on Windows?,但没有最后一步 .
主持人请注意:这不是重复的帖子 . 我的所有其他帖子都被删除了,所以我将这个帖子留在这里,并将其他问题标记为重复 .
我无法使用带有Python 3.4的Anaconda进行Theano的工作安装,而且我也无法使用MinGW进行手动安装,但我能够使用WinPython 3.4完美地运行它 .
Theano Installation and Configuration on Windows 10 with GPU Acceleration and Python 3.4
如果您使用的是Windows,那么安装和配置Theano可能会非常棘手 . 通过以下教程的组合,我能够使它工作:
Installing Keras and Theano with GPU-acceleration on Windows 10
Making Theano faster on Windows 10 with CuDNN and CNMeM
Official Theano installation instructions for Windows
Easier configuration of Theano with Python 3.4 using WinPython instead of Anaconda Python
使用WinPython而不是Anaconda Python时,让Theano在Python 3.4上运行要容易得多,但WinPython将环境设置存储在其设置目录中(例如
C:\SciSoft\WinPython-64bit-3.4.4.2\settings\.keras\
),而不是在你想要它时查看你的%USERPROFILE%
中的keras.json文件选择您的环境设置(如设置指南中所述) . 此外,如果您仍然遇到问题,可能只需要将THEANO_FLAGS
系统环境变量设置为如下所示:floatX=float32,device=gpu,nvcc.fastmath=True,lib.cnmem=0.8,blas.ldflags=-LC:\src\OpenBLAS -lopenblas
. (请注意,此环境变量会覆盖任何.theanorc安装文件中的设置,如详细here in the Theano configuration documentation,除非使用WinPython,.theanorc文件将进入C:\SciSoft\WinPython-64bit-3.4.4.2\settings\.theanorc
而不是%USERPROFILE\.theanorc
. )使用WinPython安装Theano时,如果使用建议的Theano安装位置(
C:\SciSoft\
),安装会更容易 . 在这种情况下,您的安装目录应如下所示:Fixing bugs in Theano environment batch file when using WinPython
我遇到的另一个与Theano安装指南有关的问题是批处理脚本中有一些错误导致依赖路径不正确 . 这是我的
env.bat
文件的最终版本:如果使用Theano,您的.keras文件需要设置如下:
Issue with installing CuDNN
另一个关键是需要将CuDNN DLL复制到CUDA安装目录中的相应文件夹中,以便检测它们 . 说明详述如下:Instructions for installing CuDNN into CUDA on Windows
If still having issues with Theano installation on Windows with Python 3.4:
那么请查看以下信息:Full installation guide for Theano on Windows with Python 3.4, including all required environment variables and PATH directories
Another key issue with installing the C++ dependencies for Theano
我被绊倒的另一件事是在official Theano documentation中,它提供了有关安装Microsoft Visual C++ Compiler for Python 2.7的非常具体的说明 . 似乎这个编译器也需要完全按照Theano文档指定在命令行上执行安装以使Python 3.4工作的方式安装 . 我将引用官方的Theano文档,其中说明:
General advice about GPU-acceleration
还有,仅供参考,如果您还没有尝试配置神经网络库,我强烈建议您使用GPU加速 .