【问题标题】:Theano crashing on import python3.4Theano 在导入 python3.4 时崩溃
【发布时间】:2016-09-10 22:49:14
【问题描述】:

我已经按照他们网站上针对 python3.4 用户的文档在我的 Windows 10 笔记本电脑上安装了 Theano 0.8.2。依赖项和 theano 包本身的安装是成功的,并且它们都是通过 pip 更新的。当我尝试导入 theano 时,它会产生一个我不熟悉的 very large 错误。错误的前言是打印到终端的似乎是代码的 1000 多行。

This question 似乎高度相关,但我不明白答案,而且堆栈跟踪看起来确实与我的不同。它说问题出在编译器上,但老实说我不知道​​如何解决它。有人可以帮我解决吗?

这是堆栈跟踪,减去前面的代码。

=============================== In file included from C:\Python34\include/Python.h:8:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyconfig.h:301:23: error: expected ';' at end of member declaration  # define PY_LONG_LONG __int64
                       ^ C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'  #define PY_UINT64_T unsigned PY_LONG_LONG
                              ^ C:\Python34\include/pyhash.h:65:9: note: in expansion of macro 'PY_UINT64_T'
         PY_UINT64_T k0;
         ^ In file included from C:\Python34\include/Python.h:71:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyhash.h:65:21: error: 'k0' does not name a type
         PY_UINT64_T k0;
                     ^ In file included from C:\Python34\include/Python.h:8:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyconfig.h:301:23: error: expected ';' at end of member declaration  # define PY_LONG_LONG __int64
                       ^ C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'  #define PY_UINT64_T unsigned PY_LONG_LONG
                              ^ C:\Python34\include/pyhash.h:66:9: note: in expansion of macro 'PY_UINT64_T'
         PY_UINT64_T k1;
         ^ C:\Python34\include/pyconfig.h:301:23: error: redeclaration of 'unsigned int <anonymous union>::<anonymous struct>::__int64'  # define PY_LONG_LONG __int64
                       ^ C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'  #define PY_UINT64_T unsigned PY_LONG_LONG
                              ^ C:\Python34\include/pyhash.h:66:9: note: in expansion of macro 'PY_UINT64_T'
         PY_UINT64_T k1;
         ^ C:\Python34\include/pyconfig.h:301:23: note: previous declaration 'unsigned int <anonymous union>::<anonymous struct>::__int64'  # define PY_LONG_LONG __int64
                       ^ C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'  #define PY_UINT64_T unsigned PY_LONG_LONG
                              ^ C:\Python34\include/pyhash.h:65:9: note: in expansion of macro 'PY_UINT64_T'
         PY_UINT64_T k0;
         ^ In file included from C:\Python34\include/Python.h:71:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyhash.h:66:21: error: 'k1' does not name a type
         PY_UINT64_T k1;
                     ^ In file included from C:\Python34\include/Python.h:8:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyconfig.h:301:23: error: '__int64' was not declared in this scope  # define PY_LONG_LONG __int64
                       ^ C:\Python34\include/longobject.h:88:44: note: in expansion of macro 'PY_LONG_LONG'  PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG);
                                            ^ In file included from C:\Python34\include/Python.h:50:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyconfig.h:301:23: error: '__int64' does not name a type  # define PY_LONG_LONG __int64
                       ^ C:\Python34\include/pyport.h:771:34: note: in definition of macro 'PyAPI_FUNC'  #       define PyAPI_FUNC(RTYPE) RTYPE
                                  ^ C:\Python34\include/longobject.h:90:12: note: in expansion of macro 'PY_LONG_LONG'  PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject
*);
            ^ In file included from C:\Python34\include/Python.h:78:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/longobject.h:91:35: error: expected initializer before 'PyLong_AsUnsignedLongLong'  PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *);
                                   ^ C:\Python34\include/longobject.h:92:35: error: expected initializer before 'PyLong_AsUnsignedLongLongMask'  PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
                                   ^ In file included from C:\Python34\include/Python.h:50:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyconfig.h:301:23: error: '__int64' does not name a type  # define PY_LONG_LONG __int64
                       ^ C:\Python34\include/pyport.h:771:34: note: in definition of macro 'PyAPI_FUNC'  #       define PyAPI_FUNC(RTYPE) RTYPE
                                  ^ C:\Python34\include/longobject.h:93:12: note: in expansion of macro 'PY_LONG_LONG'  PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
            ^ In file included from C:\Python34\include/Python.h:8:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1: C:\Python34\include/pyconfig.h:301:23: error: '__int64' does not name a type  # define PY_LONG_LONG __int64
                       ^ C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:281:9: note: in expansion of macro 'PY_LONG_LONG'  typedef PY_LONG_LONG npy_longlong;
         ^ In file included from C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7: C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:282:31: error: expected initializer before 'npy_ulonglong' 01005       0,        /* tp_base */  typedef unsigned PY_LONG_LONG npy_ulonglong; 01006     0,                         /* tp_dict */
                               ^ 01007      0,                         /* tp_descr_get */ In file included from C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0, 01008       0,                         /* tp_descr_set */ 01009     0,   /* tp_dictoffset */
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7: 01010      (initproc)CLazyLinker_init,/* tp_init */ 01011      0,        /* tp_alloc */ C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:583:17: error: 'npy_longlong' does not name a type 01012       CLazyLinker_new,  /* tp_new */
         typedef npy_longlong npy_int64; 01013  };
                 ^ 01014     01015  static PyObject * get_version(PyObject *dummy, PyObject *args) C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:584:17: error: 'npy_ulonglong' does not name a type 01016    {
         typedef npy_ulonglong npy_uint64; 01017      PyObject *result = PyFloat_FromDouble(0.21);
                 ^ 01018      return result; 01019  } C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:1062:9: error: 'npy_int64' does not name a type 01020   typedef npy_int64 npy_timedelta; 01021    static PyMethodDef lazylinker_ext_methods[] = {
         ^ 01022      {"get_version",  get_version, METH_VARARGS, "Get extension version."}, 01023    {NULL, NULL, 0, NULL}        /* Sentinel
*/ 01024    }; 01025     01026  #if defined(NPY_PY3K) C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:1063:9: error: 'npy_int64' does not name a type 01027 static struct PyModuleDef moduledef = {  typedef npy_int64 npy_datetime; 01028        PyModuleDef_HEAD_INIT,
         ^ 01029            "lazylinker_ext", In file included from C:\Python34\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18:0, 01030          NULL, 01031         -1,
                 from C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:23, 01032           lazylinker_ext_methods, 01033           NULL,
                 from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7: 01034          NULL, 01035         NULL, C:\Python34\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:731:9: error: 'npy_int64' does not name a type 01036            NULL
         npy_int64 year; 01037  };
         ^ 01038    #endif 01039    #if defined(NPY_PY3K) 01040 #define RETVAL m 01041  PyMODINIT_FUNC 01042    PyInit_lazylinker_ext(void) { 01043 #else 01044 #define RETVAL 01045    PyMODINIT_FUNC 01046    initlazylinker_ext(void)  01047 { 01048 #endif 01049        PyObject* m; C:\Python34\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:737:9: error: 'npy_int64' does not name a type 01050 
         npy_int64 day; 01051       lazylinker_ext_CLazyLinkerType.tp_new = PyType_GenericNew;
         ^ 01052        if (PyType_Ready(&lazylinker_ext_CLazyLinkerType) < 0) In file included from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7:0: 01053         return RETVAL; 01054    #if defined(NPY_PY3K) C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'FILE* npy_PyFile_Dup2(PyObject*, char*, off_t*)': 01055     m = PyModule_Create(&moduledef); 01056    #else C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:228:32: error: 'PyLong_AsLongLong' was not declared in this scope 01057     m
= Py_InitModule3("lazylinker_ext", lazylinker_ext_methods,
     pos = PyLong_AsLongLong(ret); 01058                           "Example module that creates an extension type.");
                                ^ 01059 #endif 01060        Py_INCREF(&lazylinker_ext_CLazyLinkerType); C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'int npy_PyFile_DupClose2(PyObject*, FILE*, off_t)': 01061       PyModule_AddObject(m, "CLazyLinker", (PyObject
*)&lazylinker_ext_CLazyLinkerType); 01062    C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:266:41: error: 'lseek' was not declared in this scope 01063      return RETVAL;
     if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) { 01064   }
                                         ^ 01065    

Problem occurred during compilation with the command line below: C:\cygwin64\bin\g++.exe -shared -g -march=haswell -mmmx -mno-3dnow
-msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=haswell
-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m32 -IC:\Python34\lib\site-packages\numpy\core\include -IC:\Python34\include -IC:\Python34\lib\site-packages\theano\gof -o C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\lazylinker_ext.pyd C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp
-LC:\Python34\libs -LC:\Python34 -lpython34 Traceback (most recent call last):   File "C:\Python34\lib\site-packages\theano\gof\lazylinker_c.py", line 74, in <module>
    raise ImportError() ImportError

During handling of the above exception, another exception occurred:

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "C:\Python34\lib\code.py", line 90, in runcode
    exec(code, self.locals)   File "<input>", line 1, in <module>   File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)   File "C:\Python34\lib\site-packages\theano\__init__.py", line 63, in <module>
    from theano.compile import (   File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)   File "C:\Python34\lib\site-packages\theano\compile\__init__.py", line 9, in <module>
    from theano.compile.function_module import *   File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)   File "C:\Python34\lib\site-packages\theano\compile\function_module.py", line 22, in <module>
    import theano.compile.mode   File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)   File "C:\Python34\lib\site-packages\theano\compile\mode.py", line 12, in <module>
    import theano.gof.vm   File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)   File "C:\Python34\lib\site-packages\theano\gof\vm.py", line 638, in <module>
    from . import lazylinker_c   File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)   File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition
2016.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)   File "C:\Python34\lib\site-packages\theano\gof\lazylinker_c.py", line 126, in <module>
    preargs=args)   File "C:\Python34\lib\site-packages\theano\gof\cmodule.py", line 2204, in compile_str
    (status, compile_stderr.replace('\n', '. '))) Exception: Compilation failed (return status=1): In file included from C:\Python34\include/Python.h:8:0,.                  from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyconfig.h:301:23: error: expected ';' at end of member declaration.  # define PY_LONG_LONG __int64 .                   ^. C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'.  #define PY_UINT64_T unsigned PY_LONG_LONG .           ^. C:\Python34\include/pyhash.h:65:9: note: in expansion of macro 'PY_UINT64_T'.          PY_UINT64_T k0; .          ^. In file included from C:\Python34\include/Python.h:71:0,.                  from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyhash.h:65:21: error: 'k0' does not name a type.  PY_UINT64_T k0; .                      ^. In file included from C:\Python34\include/Python.h:8:0,.                  from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyconfig.h:301:23: error: expected ';' at end of member declaration.  # define PY_LONG_LONG __int64 .                   ^. C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'.  #define PY_UINT64_T unsigned PY_LONG_LONG .           ^. C:\Python34\include/pyhash.h:66:9: note: in expansion of macro 'PY_UINT64_T'.          PY_UINT64_T k1; .          ^. C:\Python34\include/pyconfig.h:301:23: error: redeclaration of 'unsigned int <anonymous union>::<anonymous struct>::__int64'.  # define PY_LONG_LONG __int64 .                        ^. C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'.  #define PY_UINT64_T unsigned PY_LONG_LONG .           ^. C:\Python34\include/pyhash.h:66:9: note: in expansion of macro 'PY_UINT64_T'.          PY_UINT64_T k1; .          ^. C:\Python34\include/pyconfig.h:301:23: note: previous declaration 'unsigned int <anonymous union>::<anonymous struct>::__int64'.  # define PY_LONG_LONG __int64 .                        ^. C:\Python34\include/pyconfig.h:413:30: note: in expansion of macro 'PY_LONG_LONG'.  #define PY_UINT64_T unsigned PY_LONG_LONG .           ^. C:\Python34\include/pyhash.h:65:9: note: in expansion of macro 'PY_UINT64_T'.          PY_UINT64_T k0; .          ^. In file included from C:\Python34\include/Python.h:71:0,.                  from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyhash.h:66:21: error: 'k1' does not name a type.  PY_UINT64_T k1; .                      ^. In file included from C:\Python34\include/Python.h:8:0,.                  from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyconfig.h:301:23: error: '__int64' was not declared in this scope.  # define PY_LONG_LONG __int64 .               ^. C:\Python34\include/longobject.h:88:44: note: in expansion of macro 'PY_LONG_LONG'.  PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); .                                   ^. In file included from C:\Python34\include/Python.h:50:0,.           from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyconfig.h:301:23: error: '__int64' does not name a type.  # define PY_LONG_LONG __int64 .                        ^. C:\Python34\include/pyport.h:771:34: note: in definition of macro 'PyAPI_FUNC'.  #       define PyAPI_FUNC(RTYPE) RTYPE .                ^. C:\Python34\include/longobject.h:90:12: note: in expansion of macro 'PY_LONG_LONG'.  PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject
*); .             ^. In file included from C:\Python34\include/Python.h:78:0,.                  from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/longobject.h:91:35: error: expected initializer before 'PyLong_AsUnsignedLongLong'.  PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); .                               ^. C:\Python34\include/longobject.h:92:35: error: expected initializer before 'PyLong_AsUnsignedLongLongMask'.  PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); .             ^. In file included from C:\Python34\include/Python.h:50:0,.           from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyconfig.h:301:23: error: '__int64' does not name a type.  # define PY_LONG_LONG __int64 .                        ^. C:\Python34\include/pyport.h:771:34: note: in definition of macro 'PyAPI_FUNC'.  #       define PyAPI_FUNC(RTYPE) RTYPE .                ^. C:\Python34\include/longobject.h:93:12: note: in expansion of macro 'PY_LONG_LONG'.  PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); .             ^. In file included from C:\Python34\include/Python.h:8:0,.                  from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:1:. C:\Python34\include/pyconfig.h:301:23: error: '__int64' does not name a type.  # define PY_LONG_LONG __int64 .                        ^. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:281:9: note: in expansion of macro 'PY_LONG_LONG'.  typedef PY_LONG_LONG npy_longlong;.          ^. In file included from C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,. from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7:. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:282:31: error: expected initializer before 'npy_ulonglong'.  typedef unsigned PY_LONG_LONG npy_ulonglong;.                                ^. In file included from C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,. from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7:. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:583:17: error: 'npy_longlong' does not name a type.          typedef npy_longlong npy_int64;.                  ^. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:584:17: error: 'npy_ulonglong' does not name a type.          typedef npy_ulonglong npy_uint64;.                  ^. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:1062:9: error: 'npy_int64' does not name a type.  typedef npy_int64 npy_timedelta;.          ^. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_common.h:1063:9: error: 'npy_int64' does not name a type.  typedef npy_int64 npy_datetime;.          ^. In file included from C:\Python34\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18:0,. from C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:23,. from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7:. C:\Python34\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:731:9: error: 'npy_int64' does not name a type.          npy_int64 year;.     ^. C:\Python34\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:737:9: error: 'npy_int64' does not name a type.          npy_int64 day;.      ^. In file included from C:\Users\billy\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-3.4.3-32\lazylinker_ext\mod.cpp:7:0:. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'FILE* npy_PyFile_Dup2(PyObject*, char*, off_t*)':. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:228:32: error: 'PyLong_AsLongLong' was not declared in this scope.      pos = PyLong_AsLongLong(ret);.                                 ^. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'int npy_PyFile_DupClose2(PyObject*, FILE*, off_t)':. C:\Python34\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:266:41: error: 'lseek' was not declared in this scope.      if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {.                                          ^.

【问题讨论】:

    标签: python-3.x theano


    【解决方案1】:

    由于这个问题有点关于在 Windows 上安装 Theano,我将告诉你我建议你如何去做。

    首先,如果可能,删除任何其他 python 环境。 确保没有其他python的环境路径冲突,以防万一。

    1.安装EPD CANOPY

    2.安装 Canopy 应用程序上可用的软件包安装程序中的 MinGW 软件包

    这应该很容易做到,您只需从 Canopy 应用程序内部打开包管理器即可。

    3.从 EPD 内部安装 Theano

    你去向“pip install”发送垃圾邮件之前,如下:

    pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

    在您看到的每个命令提示符中,不要这样做

    -- 改为打开 Canopy。

    在 Canopy 屏幕中,转到“工具”,然后打开“Canopy 命令提示符”

    将打开一个与 windows 中的 CMD 完全相同的屏幕。

    在该屏幕上,执行

    pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

    现在应该可以正常工作了。

    --

    但是,不要忘记您将需要,显然是 Windows SDK,当然取决于 Windows 版本。 你可以尝试安装最后一个 Visual Studio 附带你需要的一切。

    如果您需要这方面的更多信息,请查看相关的 Stackoverflow 主题:

    Installing theano

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-12
      • 1970-01-01
      • 1970-01-01
      • 2022-10-05
      • 2017-01-08
      • 2020-10-18
      相关资源
      最近更新 更多