[英]How to install Theano on Anaconda Python 2.7 x64 on Windows?
I wonder how to install Theano on Anaconda Python 2.7 x64 on Windows 7 x64.我想知道如何在 Windows 7 x64 上的 Anaconda Python 2.7 x64 上安装 Theano。 The Theano website provides some instructions but is not clear as to what is specific to Anaconda.
Theano 网站提供了一些说明,但不清楚 Anaconda 的具体内容。
I'm not 100% certain but this may be a minimal set of instructions, but only if you don't want to use a GPU.我不是 100% 肯定,但这可能是最少的指令集,但前提是您不想使用 GPU。 Getting Theano to use a GPU on Windows is quite a bit more difficult.
让 Theano 在 Windows 上使用 GPU 有点困难。
conda update conda
.conda update conda
。conda update --all
.conda update --all
。conda install mingw libpython
.conda install mingw libpython
。pip install Theano
. pip install Theano
。pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
(see linked documentation for more options) pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
(有关更多选项,请参阅链接文档) If you want multithreading support via OpenMP then things get more complicated.如果您希望通过 OpenMP 支持多线程,那么事情会变得更加复杂。
If you want GPU support things get much more complicated.如果您想要 GPU 支持,事情会变得更加复杂。
The Windows installation instructions in the Theano documentation are fragmented at best, and terribly out of date at worst. Theano 文档中的 Windows 安装说明充其量是零散的,最糟糕的是已经过时了。 If you need more than the basics working on Windows, you'll need to pick your way through to find an approach that works for you.
如果您需要的不仅仅是在 Windows 上工作的基础知识,您将需要通过自己的方式找到适合您的方法。
The trick is that YOU NEED TO CREATE AN ENVIRONMENT/WORKSPACE FOR PYTHON .诀窍是您需要为 PYTHON 创建环境/工作区。 This solution should work for Python 2.7 but at the time of writing keras can run on python 3.5, especially if you have the latest anaconda installed (this took me awhile to figure out so I'll outline the steps I took to install KERAS in python 3.5):
这个解决方案应该适用于 Python 2.7,但在撰写本文时,keras 可以在 python 3.5 上运行,特别是如果你安装了最新的 anaconda(这花了我一段时间才弄清楚,所以我将概述我在 python 中安装 KERAS 所采取的步骤3.5):
-- CREATE ENVIRONMENT/WORKSPACE FOR PYTHON 3.5: --为 Python 3.5 创建环境/工作区:
C:\\conda create --name neuralnets python=3.5
C:\\activate neuralnets
-- INSTALL EVERYTHING (notice the neuralnets workspace in parenthesis on each line). --安装所有东西(注意每行括号中的神经网络工作区)。 ACCEPT ANY DEPENDENCIES EACH OF THOSE STEPS WANTS TO INSTALL :
接受每个步骤要安装的任何依赖项:
(neuralnets) C:\\conda install theano
(neuralnets) C:\\conda install mingw libpython
(neuralnets) C:\\pip install tensorflow
(neuralnets) C:\\pip install keras
-- TEST IT OUT: --测试一下:
(neuralnets) C:\python -c "from keras import backend; print(backend._BACKEND)"
Just remember, if you want to work in the workspace you always have to do:请记住,如果您想在工作区中工作,您必须始终执行以下操作:
C:\activate neuralnets
so you can launch Jypiter for example (assuming you also have jypiter installed in this environment/workspace) as:例如,您可以启动 Jypiter(假设您在此环境/工作区中还安装了 jypiter):
C:\activate neuralnets
(neuralnets) jypiter notebook
You can read more about managing and creating conda environments/workspaces at the follwing URL: https://conda.io/docs/using/envs.html
您可以在以下 URL 中阅读有关管理和创建 conda 环境/工作区的更多信息: https : //conda.io/docs/using/envs.html
Adding GPU support is not that much more complicated (although not intuitive)添加 GPU 支持并没有那么复杂(虽然不直观)
Nvidia GPU support (CUDA)
section with the following changes:Nvidia GPU support (CUDA)
部分按照以下更改进行操作:
visual studio 2013 community
instead of the Windows SDKvisual studio 2013 community
而不是 Windows SDK.theanorc
should be placed in C:\\Users\\USERNAME
.theanorc
应该放在C:\\Users\\USERNAME
If you need Theano on python 2.7 and you already installed Anaconda, you can type the following in a command prompt:如果你在 python 2.7 上需要 Theano 并且你已经安装了 Anaconda,你可以在命令提示符中键入以下内容:
conda create -n Python_27 python=2.7.16
conda activate Python_27
conda install numpy=1.12 scipy mkl-service libpython
conda install theano
It appears that the windows python 2.7 numpy packages don't include the _mklinit patch.似乎 windows python 2.7 numpy 包不包含 _mklinit 补丁。 Either set the MKL_THREADING_LAYER in your env or update to python 3 which does have patched packages.
在您的 env 中设置 MKL_THREADING_LAYER 或更新到具有修补程序包的 python 3。 You can type in your env:
你可以输入你的环境:
python
import os
os.environ["MKL_THREADING_LAYER"] = "GNU"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.