【问题标题】:Difficulties installing Theano on 64-bit Windows 10 System, Python 3在 64 位 Windows 10 系统、Python 3 上安装 Theano 的困难
【发布时间】:2017-03-17 17:26:05
【问题描述】:

在这里拉我的头发,大约 8 小时后,对此有点绝望......

从 Python 命令行运行“import theano”时,基本上我得到以下跟踪:

Problem occurred during compilation with the command line below:
"C:\Users\User Name\Anaconda3\Scripts\g++.bat" -shared -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"C:\Users\User Name\Anaconda3\lib\site-packages\numpy\core\include" -I"C:\Users\User Name\Anaconda3\include" -I"C:\Users\User Name\Anaconda3\lib\site-packages\theano\gof" -L"C:\Users\User Name\Anaconda3\libs" -L"C:\Users\User Name\Anaconda3" -o C:\Users\User Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\User Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\mod.cpp -lpython34
g++.exe: error: Kronk\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\lazylinker_ext.pyd: No such file or directory
g++.exe: error: C:\Users\Charles: No such file or directory
g++.exe: error: Kronk\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\mod.cpp: No such file or directory

Traceback (most recent call last):
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\__init__.py", line 70, in <module>
    from theano.compile import (
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\compile\__init__.py", line 10, in <module>
    from theano.compile.function_module import *
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 21, in <module>
    import theano.compile.mode
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\compile\mode.py", line 10, in <module>
    import theano.gof.vm
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\gof\vm.py", line 659, in <module>
    from . import lazylinker_c
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\User Name\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 2323, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): g++.exe: error: Kronk\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\lazylinker_ext.pyd: No such file or direc. g++.exe: error: Kronk\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_Genui. Intel-3.4.5-64\lazylinker_ext\mod.cpp: No such file or directory

此时我已经尝试了十几个在线教程,所以我将介绍到目前为止我所做的/已安装的内容。

系统规格: 操作系统名称:Microsoft Windows 10 家庭版 系统类型:基于 x64 的 PC BIOS模式:UEFI

Python 安装 [python -V]: Python 3.4.5 :: Anaconda 自定义(64 位)

已安装 Python 包 [conda 列表]:

# packages in environment at C:\Users\User Name\Anaconda3:
#
_license                  1.1                      py34_1
alabaster                 0.7.9                    py34_0
anaconda                  custom                   py34_0
anaconda-client           1.5.3                    py34_0
argcomplete               1.0.0                    py34_1
astropy                   1.2.1               np111py34_0
babel                     2.3.4                    py34_0
backports_abc             0.4                      py34_0
bcolz                     1.0.0                    py34_0
beautiful-soup            4.3.2                    py34_1
binstar                   0.12                          2
bitarray                  0.8.1                    py34_1
blaze-core                0.9.0                    py34_0
blz                       removed                       0
bokeh                     0.12.3                   py34_1
boto                      2.43.0                   py34_0
bottleneck                1.1.0               np111py34_0
bzip2                     1.0.6                    vc10_3  [vc10]
certifi                   2016.2.28                py34_0
cffi                      1.8.3                    py34_0
click                     6.6                      py34_0
clyent                    1.2.2                    py34_0
colorama                  0.3.7                    py34_0
comtypes                  1.1.2                    py34_0
conda                     4.2.12                   py34_0
conda-build               2.0.7                    py34_0
conda-env                 2.6.0                         0
configobj                 5.0.6                    py34_0
cryptography              1.5.2                    py34_0
cycler                    0.10.0                   py34_0
cython                    0.25.1                   py34_0
cytoolz                   0.8.0                    py34_0
datashape                 0.5.2                    py34_0
decorator                 4.0.10                   py34_0
Django                    1.10.2                    <pip>
docutils                  0.12                     py34_2
dynd-python               removed                       0
entrypoints               0.2.2                    py34_0
et_xmlfile                1.0.1                    py34_0
fastcache                 1.0.2                    py34_1
filelock                  2.0.6                    py34_0
flask                     0.11.1                   py34_0
freetype                  2.5.5                    vc10_1  [vc10]
greenlet                  0.4.10                   py34_0
h5py                      2.6.0               np111py34_2
hdf5                      1.8.15.1                 vc10_4  [vc10]
idna                      2.1                      py34_0
imagesize                 0.7.1                    py34_0
ipykernel                 4.5.0                    py34_0
ipython                   5.1.0                    py34_0
ipython-notebook          4.0.4                    py34_3
ipython-qtconsole         4.0.1                    py34_4
ipython_genutils          0.1.0                    py34_0
itsdangerous              0.24                     py34_0
jdcal                     1.3                      py34_0
jedi                      0.9.0                    py34_1
jinja2                    2.8                      py34_1
jpeg                      8d                       vc10_2  [vc10]
jsonschema                2.5.1                    py34_0
jupyter_client            4.4.0                    py34_0
jupyter_core              4.2.0                    py34_0
Lasagne                   0.1                       <pip>
launcher                  1.0.0                         4
libpng                    1.6.22                   vc10_0  [vc10]
libpython                 3.4.3                     <pip>
libpython                 2.0                      py34_0
libtiff                   4.0.6                    vc10_2  [vc10]
llvmlite                  0.14.0                   py34_0
lxml                      3.6.4                    py34_0
m2w64-binutils            2.25.1                        4
m2w64-bzip2               1.0.6                         5
m2w64-crt-git             5.0.0.4636.2595836               1
m2w64-gcc                 5.3.0                         5
m2w64-gcc-ada             5.3.0                         5
m2w64-gcc-fortran         5.3.0                         5
m2w64-gcc-libgfortran     5.3.0                         5
m2w64-gcc-libs            5.3.0                         6
m2w64-gcc-objc            5.3.0                         5
m2w64-gmp                 6.1.0                         1
m2w64-headers-git         5.0.0.4636.c0ad18a               1
m2w64-isl                 0.16.1                        1
m2w64-libiconv            1.14                          5
m2w64-libmangle-git       5.0.0.4509.2e5a9a2               1
m2w64-libwinpthread-git   5.0.0.4634.697f757               1
m2w64-make                4.1.2351.a80a8b8               1
m2w64-mpc                 1.0.3                         2
m2w64-mpfr                3.1.4                         3
m2w64-pkg-config          0.29.1                        1
m2w64-toolchain           5.3.0                         6
m2w64-tools-git           5.0.0.4592.90b8472               1
m2w64-windows-default-manifest 6.4                           2
m2w64-winpthreads-git     5.0.0.4634.697f757               1
m2w64-zlib                1.2.8                         9
markupsafe                0.23                     py34_2
matplotlib                1.5.1               np111py34_0
menuinst                  1.4.2                    py34_1
mingw                     4.7                           1
mistune                   0.7.3                    py34_0
mkl                       11.3.3                        1
mkl-service               1.1.2                    py34_2
mock                      2.0.0                    py34_0
mpmath                    0.19                     py34_1
msys2-conda-epoch         20160418                      0
multipledispatch          0.4.9                    py34_0
mysqlclient               1.3.7                     <pip>
nbconvert                 4.2.0                    py34_0
nbformat                  4.1.0                    py34_0
networkx                  1.11                     py34_0
nltk                      3.2.1                    py34_0
node-webkit               0.10.1                        0
nose                      1.3.7                    py34_1
notebook                  4.2.3                    py34_0
numba                     0.29.0              np111py34_0
numexpr                   2.6.1               np111py34_1
numpy                     1.11.2                   py34_0
odo                       0.5.0                    py34_1
openpyxl                  2.4.0                    py34_0
openssl                   1.0.2j                   vc10_0  [vc10]
pandas                    0.19.0              np111py34_0
path.py                   8.2.1                    py34_0
patsy                     0.4.1                    py34_0
pbr                       1.10.0                   py34_0
pep8                      1.7.0                    py34_0
pickleshare               0.7.4                    py34_0
pillow                    3.4.2                    py34_0
pip                       8.1.2                    py34_0
pip                       9.0.0                     <pip>
pip                       8.1.2                     <pip>
pkginfo                   1.3.2                    py34_0
ply                       3.9                      py34_0
prompt_toolkit            1.0.8                    py34_0
psutil                    4.4.2                    py34_0
psycopg2                  2.6.2                     <pip>
py                        1.4.31                   py34_0
pyasn1                    0.1.9                    py34_0
pycosat                   0.6.1                    py34_1
pycparser                 2.16                     py34_0
pycrypto                  2.6.1                    py34_4
pyflakes                  1.3.0                    py34_0
pygments                  2.1.3                    py34_0
pyopenssl                 16.0.0                   py34_0
pyparsing                 2.1.4                    py34_0
pyqt                      4.11.4                   py34_7
pyreadline                2.1                      py34_0
pytables                  3.2.2               np111py34_4
pytest                    3.0.3                    py34_0
python                    3.4.5                         0
python-dateutil           2.5.3                    py34_0
pytz                      2016.7                   py34_0
pywin32                   220                      py34_1
pyyaml                    3.12                     py34_0
pyzmq                     16.0.0                   py34_0
qt                        4.8.7                    vc10_9  [vc10]
qtconsole                 4.2.1                    py34_0
requests                  2.11.1                   py34_0
rope                      0.9.4                    py34_1
ruamel_yaml               0.11.14                  py34_0
runipy                    0.1.3                    py34_0
scikit-image              0.12.3              np111py34_1
scikit-learn              0.17.1                    <pip>
scikit-learn              0.18                np111py34_0
scikit-neuralnetwork      0.7                       <pip>
scipy                     0.18.1              np111py34_0
setuptools                27.2.0                   py34_1
simplegeneric             0.8.1                    py34_1
sip                       4.18                     py34_0
six                       1.10.0                   py34_0
snowballstemmer           1.2.1                    py34_0
sockjs-tornado            1.0.3                    py34_0
sphinx                    1.4.8                    py34_0
sphinx_rtd_theme          0.1.9                    py34_0
spyder                    2.3.8                    py34_1
spyder-app                2.3.8                    py34_0
sqlalchemy                1.1.3                    py34_0
statsmodels               0.6.1               np111py34_1
sympy                     1.0                      py34_0
Theano                    0.9.0.dev4                <pip>
theano                    0.8.2                    py34_0
tk                        8.5.18                   vc10_0  [vc10]
toolz                     0.8.0                    py34_0
tornado                   4.4.2                    py34_0
traitlets                 4.3.1                    py34_0
ujson                     1.35                     py34_0
vs2010_runtime            10.00.40219.1                 2
wcwidth                   0.1.7                    py34_0
werkzeug                  0.11.11                  py34_0
wheel                     0.29.0                   py34_0
win_unicode_console       0.5                      py34_0
xlrd                      1.0.0                    py34_0
xlsxwriter                0.9.3                    py34_0
xlwings                   0.10.0                   py34_0
xlwt                      1.1.2                    py34_0
zlib                      1.2.8                    vc10_3  [vc10]

已安装的程序(我认为相关的那些?):

  • Microsoft .NET Framework 4.5 SDK
  • Microsoft .NET Framework 4.6 SDK
  • Microsoft .NET Framework 4.6.1 SDK
  • Microsoft Visual C++ 2005 Redistributable
  • Microsoft Visual C++ 2008 Redistributable
  • Microsoft Visual C++ 2010 Redistributable
  • Microsoft Visual C++ 2012 Redistributable
  • Microsoft Visual C++ 2013 Redistributable
  • Microsoft Visual C++ 2015 Redistributable
  • Microsoft Visual C++ 编译器 2010 SP1 标准
  • Microsoft Visual Studio Community 2015 更新
  • 适用于 Windows 桌面的 Microsoft Visual Studio Express 2012
  • 适用于 Windows 桌面的 Microsoft Visual Studio Express 2015
  • 适用于 Windows 7 (7.1) 的 Microsoft Windows SDK
  • NVIDIA CUDA 工具包 5.5
  • NVIDIA 显卡驱动程序 354.74
  • TDM-GCC

环境变量(回显 %PATH%):

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\SASHome\SASFoundation\9.4\ets\sasexe;C:\Program Files\SASHome\Secure\ccme4;C:\Program Files\SASHome\x86\Secure\ccme4;C:\Program Files (x86)\PharosSystems\Core;C:\Program Files (x86)\Brackets\command;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files (x86)\Skype\Phone\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Users\User Name\Anaconda3;C:\Users\User Name\Anaconda3\Scripts;C:\Users\User Name\AppData\Roaming\npm;C:\Users\User Name\AppData\Local\Microsoft\WindowsApps;C:\TDM-GCC-64\x86_64-w64-mingw32\bin;C:\blaslapack;Name=THEANO_FLAGS, Value=floatX=float32,device=cpu,blas.ldflags=-LC:/blaslapack -lblas;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

任何帮助都会非常、非常、非常感谢!!!!

如果需要更多信息来进行正确诊断,请告诉我。

编辑 1:

我在下面 Andrej Žukov-Gregorič 发布的教程之后遇到的错误:

Problem occurred during compilation with the command line below:
C:\Users\User Name\Anaconda3\envs\py34\MinGW\bin\g++.exe -shared -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\numpy\core\include" -I"C:\Users\User Name\Anaconda3\envs\py34\include" -I"C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof" -L"C:\Users\User Name\Anaconda3\envs\py34\libs" -L"C:\Users\User Name\Anaconda3\envs\py34" -o C:\Users\User Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\User Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\mod.cpp -lpython34
'C:\Users\User' is not recognized as an internal or external command,
operable program or batch file.

Traceback (most recent call last):
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\__init__.py", line 70, in <module>
    from theano.compile import (
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\compile\__init__.py", line 10, in <module>
    from theano.compile.function_module import *
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\compile\function_module.py", line 21, in <module>
    import theano.compile.mode
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\compile\mode.py", line 10, in <module>
    import theano.gof.vm
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\vm.py", line 659, in <module>
    from . import lazylinker_c
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\cmodule.py", line 2323, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): 'C:\Users\User' . operable program or batch file.or external command,

编辑 2:

好的,所以我弄乱了我的 .theanorc 文件...我有:

[global]
cxx=C:\Users\User Name\Anaconda3\envs\py34\MinGW\bin\g++.exe

代替

[global]
cxx="C:\Users\User Name\Anaconda3\envs\py34\MinGW\bin\g++.exe"

但是,现在我收到以下错误:

Problem occurred during compilation with the command line below:
"C:\Users\User Name\Anaconda3\envs\py34\MinGW\bin\g++.exe" -shared -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I"C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\numpy\core\include" -I"C:\Users\User Name\Anaconda3\envs\py34\include" -I"C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof" -L"C:\Users\User Name\Anaconda3\envs\py34\libs" -L"C:\Users\User Name\Anaconda3\envs\py34" -o C:\Users\User Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\User Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\mod.cpp -lpython34
g++.exe: error: Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\lazylinker_ext.pyd: No such file or directory
g++.exe: error: C:\Users\User: No such file or directory
g++.exe: error: Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\mod.cpp: No such file or directory

Traceback (most recent call last):
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\lazylinker_c.py", line 75, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\lazylinker_c.py", line 92, in <module>
    raise ImportError()
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\__init__.py", line 70, in <module>
    from theano.compile import (
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\compile\__init__.py", line 10, in <module>
    from theano.compile.function_module import *
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\compile\function_module.py", line 21, in <module>
    import theano.compile.mode
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\compile\mode.py", line 10, in <module>
    import theano.gof.vm
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\vm.py", line 659, in <module>
    from . import lazylinker_c
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\lazylinker_c.py", line 127, in <module>
    preargs=args)
  File "C:\Users\User Name\Anaconda3\envs\py34\lib\site-packages\theano\gof\cmodule.py", line 2323, in compile_str
    (status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): g++.exe: error: Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\lazylinker_ext.pyd: No such file. g++.exe: error: Name\AppData\Local\Theano\compiledir_Windows-10-10.0.14393-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.4.5-64\lazylinker_ext\mo. cpp: No such file or directory

【问题讨论】:

    标签: python-3.x gcc anaconda theano mingw-w64


    【解决方案1】:

    我能够在支持 GPU 的 Windows 10 机器上安装 Theano for python 3。对我来说,我找到了the most helpful guide to be this one,并且非常仔细地跟踪它。

    如果您正在寻找更多灵感,您也可以尝试以下链接,但我强烈建议您只遵循上面链接的教程alt-link-1, alt-link-2

    祝你好运。

    【讨论】:

      【解决方案2】:

      安装 theano:

      1. 设置Anaconda - python 语言的免费开源发行版。它带有 conda,它自己的包管理器。从 Anaconda 的网站下载 64 位 python 3.x 安装程序并安装它。
      2. 通过运行conda create -n py34 python=3.4 anaconda 安装python 3.4 环境(我听说有人遇到3.5 问题)。要从默认的 python 3.x 环境切换到 3.4 环境,只需运行activate py34
      3. 运行 conda install mingw libpython 这会将 c++ 编译器安装到您的 py34 环境中。
      4. 查看 theano 的最新前沿版本。转到 Theano 的github page,点击Clone or download &gt; Downdload ZIP
      5. 运行pip --no-cache-dir install theano-master.zip。 (在撰写本文时,conda 不包含 theano,因此您必须使用 pip 来安装它。) --no-cache-dir 标志的原因是强制全新安装并防止 pip 使用任何以前缓存的theano 文件。
      6. 创建一个名为.theanorc 的空白文件并将其放在您的主目录中,在Windows 上通常为C:\Users\username。用以下内容填充它:

        [global]
        cxx=C:\<path_to_anaconda>\Anaconda3\envs\py34\MinGW\bin\g++.exe 
        

        这告诉 theano 在哪里可以找到 c++ 编译器。

      7. 将 g++.exe 添加到您的环境路径中

      提示:

      1. 一个不错的 windows linux 控制台模拟器,因为 windows 命令提示符对某些人来说很烦人:cmdr - 使用它来输入你的 conda 命令等。
      2. Windows 中的How to set environment variables - 本质上,将;C:\&lt;path_to_anaconda&gt;\Anaconda3\envs\py34\MinGW\bin\g++.exe 添加到路径的末尾。

      【讨论】:

      • 我遵循了这一点,当我运行 activate py34pythonimport theano 时遇到了一个新错误。 (注意,一旦我更改了环境变量,我确实重新启动了命令提示符,这通过运行echo %PATH% 得到确认)。我会将错误发布为对原始问题的编辑。
      • 等等等等...我搞砸了一些东西,但我仍然得到一个不同的错误等等...
      • 似乎指向错误的位置:(您输入的用户名是否正确?路径中有空格吗?您是否调用了python 3.4环境py34?不确定是否:stackoverflow.com/questions/3848357/…是相关的,但也许你必须重新启动/打开一个新终端。
      • 路径中有空格...有什么办法解决吗?谢谢!!
      猜你喜欢
      • 2017-10-17
      • 1970-01-01
      • 1970-01-01
      • 2017-12-19
      • 2016-07-30
      • 2015-11-05
      • 2015-12-07
      • 1970-01-01
      相关资源
      最近更新 更多