Python 3.x 在64位Windows 10系统、Python 3上安装Theano的困难

Python 3.x 在64位Windows 10系统、Python 3上安装Theano的困难,python-3.x,gcc,anaconda,theano,mingw-w64,Python 3.x,Gcc,Anaconda,Theano,Mingw W64,把我的头发拔出来,大约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

把我的头发拔出来,大约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
任何帮助都将非常非常感谢

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

编辑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,
而不是

[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
使用下面的命令行编译时出现问题: “C:\Users\User Name\Anaconda3\envs\py34\MinGW\bin\g++.exe”-shared-g-DNPY\u NO\u DEPRECATED\u API=NPY\u 1\u 7\u API\u VERSION-m64-DMS\u WIN64-I“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\numpy\core\include”--I“C:\Users\User\User\User Name\Anaconda3\envs\lib\site packages\py34\f”–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\u Windows-10-10.0.14393-Intel64\u Family\u 6\u Model\u 94\u Stepping\u 3\u GenuineIntel-3.4.5-64\lazylinker\u ext\lazylinker\u ext.pyd C:\Users\User\User Name\AppData\Local\Theano\compiledir\u Windows-10-10-10.0.14393-Intel64\u Family\u 6\u Model\u Stepping\u genuinel-intel94\u steppy g++.exe:错误:Name\AppData\Local\Theano\compiledir\u Windows-10-10.0.14393-Intel64\u Family\u 6\u Model\u 94\u Stepping\u 3\u GenuineIntel-3.4.5-64\lazylinker\u ext\lazylinker\u ext.pyd:没有这样的文件或目录 g++.exe:错误:C:\Users\User:没有这样的文件或目录 g++.exe:错误:Name\AppData\Local\Theano\compiledir\u Windows-10-10.0.14393-Intel64\u Family\u 6\u Model\u 94\u Stepping\u 3\u GenuineIntel-3.4.5-64\lazylinker\u ext\mod.cpp:没有这样的文件或目录 回溯(最近一次呼叫最后一次): 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\gof\lazylinker\u C.py”,第75行,在 提高警惕() 强求恐怖 在处理上述异常期间,发生了另一个异常: 回溯(最近一次呼叫最后一次): 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\gof\lazylinker\u C.py”,第92行,在 提高警惕() 强求恐怖 在处理上述异常期间,发生了另一个异常: 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\\uuuuu init\uuuu.py”,第70行,在 从theano.compile导入( 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\compile\\uuuu init\uuuu.py”,第10行,在 从a No.compile.function\u模块导入* 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\compile\function\u module.py”,第21行,在 导入theano.compile.mode 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\compile\mode.py”,第10行,在 导入theano.gof.vm 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\gof\vm.py”,第659行,在 from.导入lazylinker_c 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\gof\lazylinker\u C.py”,第127行,在 preargs=args) 文件“C:\Users\User Name\Anaconda3\envs\py34\lib\site packages\theano\gof\cmodule.py”,第2323行,在compile\u str中 (状态,编译\u stderr.replace('\n','.')) 异常:编译失败(返回状态=1):g++.exe:错误:Name\AppData\Local\Theano\compiledir\u Windows-10-10.0.14393-Intel64\u Family\u 6\u Model\u 94\u Stepping\u 3\u GenuineIntel-3.4.5-64\lazylinker\u ext\lazylinker\u ext.pyd:无此类文件。g++.exe:错误:Name\AppData\Local\Theano\compiledir\u Windows-10-10.0.14393-Intel64\u Family\u 6\u Model\u 94\u Stepping\u 3\u GenuineIntel-3.4.5-64\lazylinker\u ext\mo。cpp:没有这样的文件或目录
我能够在支持GPU的windows 10机器上安装Theano for python 3。对我来说,我找到了,我非常仔细地遵循它

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


祝你好运。

安装theano:

  • 设置-python语言的免费开源发行版。它附带康达,它自己的包管理器。从Anaconda的网站下载64位python 3.x安装程序并安装它
  • 通过运行
    condacreate-npy34 python=3.4 anaconda
    安装python 3.4环境(我听说有人在3.5方面有问题)。要从默认的Python3.x环境切换到3.4环境,只需运行
    activate py34
  • <运行>代码> CONDA安装明文LIPPython < /Cord>。这将在您的PY34环境中安装一个C++编译器。
  • 检查theano的最新前沿版本。到Theano's,点击
    克隆或下载>下载ZIP
  • 运行
    pip--no cache dir安装ano master.zip
    。(在编写conda时不包含theano,因此必须使用pip来安装它。)--no cache dir标志的原因是强制进行干净的安装,并防止pip使用任何以前缓存的theano文件
  • 创建一个名为
    .theanoc
    的空白文件,并将其放置在windows上的主目录中,该目录通常是
    C:\Users\username
    。使用以下内容填充它:

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

    这告诉了在哪里找到C++编译器。

  • 将g++.exe添加到环境路径
  • 提示:

  • 一个很好的linux控制台windows仿真器,因为windows命令提示符对某些人来说很烦人:-使用它输入您的conda命令等
  • 在windows中-本质上,添加
    ;C:\\Anaconda3\envs\py34\MinGW\bin\g++.exe
    到路径的末尾
    在运行
    activate py34
    python
    import theano
    时,我遇到了一个新错误。(注:是的
    [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
    
    [global]
    cxx=C:\<path_to_anaconda>\Anaconda3\envs\py34\MinGW\bin\g++.exe