- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
该线程中提出的解决方案对我不起作用:
Import theano gives the AttributeError: module 'theano' has no attribute 'gof'
我试过conda install theano
(对于 jupyter notebook),尽管安装完美,但我仍然收到上述错误。
我正在使用 Python 3.6、Windows 7、Anaconda/Jupyter 笔记本和 Nvidia 1070 GPU。 Theano 是 .9.0 版本
回溯如下:
ImportError Traceback (most recent call last)
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
74 if version != getattr(lazylinker_ext, '_version', None):
---> 75 raise ImportError()
76 except ImportError:
ImportError:
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
91 if version != getattr(lazylinker_ext, '_version', None):
---> 92 raise ImportError()
93 except ImportError:
ImportError:
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\vm.py in <module>()
661 raise theano.gof.cmodule.MissingGXX('lazylinker will not be imported if theano.config.cxx is not set.')
--> 662 from . import lazylinker_c
663
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\lazylinker_c.py in <module>()
126 cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
--> 127 preargs=args)
128 # Save version into the __init__.py file.
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
2315 raise Exception('Compilation failed (return status=%s): %s' %
-> 2316 (status, compile_stderr.replace('\n', '. ')))
2317 elif config.cmodule.compilation_warning and compile_stderr:
Exception: Compilation failed (return status=1): In file included from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/Python.h:50:0,. from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).". #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).". ^. In file included from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/Python.h:133:0,. from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:23:5: error: '__int64' does not name a type. __int64 st_ino;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:29:5: error: '__int64' does not name a type. __int64 st_size;. ^. In file included from /usr/include/sys/stat.h:22:0,. from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/pyport.h:227,. from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/Python.h:50,. from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:30:12: error: expected ';' at end of member declaration. time_t st_atime;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:30:12: error: expected unqualified-id before '.' token. time_t st_atime;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:32:12: error: expected ';' at end of member declaration. time_t st_mtime;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:32:12: error: expected unqualified-id before '.' token. time_t st_mtime;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:34:12: error: expected ';' at end of member declaration. time_t st_ctime;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/fileutils.h:34:12: error: expected unqualified-id before '.' token. time_t st_ctime;. ^. In file included from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/Python.h:8:0,. from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:1:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\include/pyconfig.h:269:23: error: '__int64' does not name a type. # define PY_LONG_LONG __int64. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_common.h:309:9: note: in expansion of macro 'PY_LONG_LONG'. typedef PY_LONG_LONG npy_longlong;. ^. In file included from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,. from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_common.h:310:31: error: expected initializer before 'npy_ulonglong'. typedef unsigned PY_LONG_LONG npy_ulonglong;. ^. In file included from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:22:0,. from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_common.h:611:17: error: 'npy_longlong' does not name a type. typedef npy_longlong npy_int64;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_common.h:612:17: error: 'npy_ulonglong' does not name a type. typedef npy_ulonglong npy_uint64;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_common.h:1090:9: error: 'npy_int64' does not name a type. typedef npy_int64 npy_timedelta;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_common.h:1091:9: error: 'npy_int64' does not name a type. typedef npy_int64 npy_datetime;. ^. In file included from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18:0,. from C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:23,. from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:742:9: error: 'npy_int64' does not name a type. npy_int64 year;. ^. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:748:9: error: 'npy_int64' does not name a type. npy_int64 day;. ^. In file included from C:\Users\Moondra\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.6.0-64\lazylinker_ext\mod.cpp:7:0:. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h: In function 'int npy_PyFile_DupClose2(PyObject*, FILE*, off_t)':. C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\include/numpy/npy_3kcompat.h:274:41: error: 'lseek' was not declared in this scope. if (npy_lseek(fd, orig_pos, SEEK_SET) == -1) {. ^.
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-6-3397704bd624> in <module>()
----> 1 import theano
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\__init__.py in <module>()
64 object2, utils)
65
---> 66 from theano.compile import (
67 SymbolicInput, In,
68 SymbolicOutput, Out,
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\__init__.py in <module>()
8 SpecifyShape, specify_shape, register_specify_shape_c_code)
9
---> 10 from theano.compile.function_module import *
11
12 from theano.compile.mode import *
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\function_module.py in <module>()
19 from theano.compat import izip
20 from theano.gof import graph
---> 21 import theano.compile.mode
22 import theano.compile.profiling
23 from theano.compile.io import (
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\compile\mode.py in <module>()
8 import theano
9 from theano import gof
---> 10 import theano.gof.vm
11 from theano.configparser import config
12 from theano.compile.ops import _output_guard
C:\Users\Moondra\AppData\Local\Programs\Python\Python36\lib\site-packages\theano\gof\vm.py in <module>()
669 except ImportError:
670 pass
--> 671 except (OSError, theano.gof.cmodule.MissingGXX) as e:
672 # OSError happens when g++ is not installed. In that case, we
673 # already changed the default linker to something else then CVM.
AttributeError: module 'theano' has no attribute 'gof'
conda install theano
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-3397704bd624> in <module>()
----> 1 import theano
ModuleNotFoundError: No module named 'theano'
No module named 'theano'
theano
在
site-packages
anaconda 文件夹中的文件夹。
AttributeError: module 'theano' has no attribute 'gof'
最佳答案
对我来说,这是一个 numpy 版本问题。一旦我将我的 numpy 重新安装到 1.13.1 版,它就可以工作了。
注意:确保以兼容的方式更新其他依赖于 numpy 的包,例如 Scikit-learn 等。最好的方法是为深度学习创建一个环境。
关于deep-learning - Theano:AttributeError:模块 'theano'没有属性 'gof',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44103230/
如何通过索引向量在 Theano 中索引矩阵? 更准确地说: v 的类型为 theano.tensor.vector(例如 [0,2]) A 具有 theano.tensor.matrix 类型(例如
我是theano的新手。我正在尝试实现简单的线性回归,但我的程序抛出以下错误: TypeError: ('Bad input argument to theano function with name
我有一个被多次调用的 Theano 函数,每次都使用不同的共享变量。按照现在的实现方式,Theano 函数在每次运行时都会重新定义。我假设,这会使整个程序变慢,因为每次定义 Theano 函数时,都会
我正在阅读http://deeplearning.net/tutorial/logreg.html给出的逻辑函数代码。我对函数的inputs和givens变量之间的区别感到困惑。计算微型批次中的模型所
我是 Theano 的新手。 尝试设置配置文件。 首先,我注意到我没有 .theanorc 文件: locate .theanorc - 不返回任何内容 echo $THEANORC - 不返回任何内
我不明白为什么我们在 Theano 中需要 tensor.reshape() 函数。文档中说: Returns a view of this tensor that has been reshaped
给定一个张量 v = t.vector(),我该如何翻转它?例如,[1, 2, 3, 4, 5, 6] 翻转后是 [6, 5, 4, 3, 2, 1]。 最佳答案 您可以简单地执行 v[::-1].e
我是 Theano 的新手,正在尝试一些示例。 import numpy import theano.tensor as T from theano import function import da
出于诊断目的,我定期获取网络的梯度。一种方法是将梯度作为 theano 函数的输出返回。然而,每次都将梯度从 GPU 复制到 CPU 内存可能代价高昂,所以我宁愿只定期进行。目前,我通过创建两个函数对
我阅读了网络上所有关于人们忘记将目标向量更改为矩阵的问题的帖子,由于更改后问题仍然存在,我决定在这里提出我的问题。下面提到了解决方法,但出现了新问题,我感谢您的建议! 使用卷积网络设置和带有 sigm
我需要通过扫描多次执行 theano 函数,以便总结成本函数并将其用于梯度计算。我熟悉执行此操作的深度学习教程,但我的数据切片和其他一些复杂情况意味着我需要做一些不同的事情。 下面是我正在尝试做的一个
我正在尝试学习(和比较)不同的深度学习框架,到时候它们是 Caffe 和 Theano。 http://caffe.berkeleyvision.org/gathered/examples/mnist
下面的代码: import theano import numpy as np from theano import tensor as T h1=T.as_tensor_variable(np.ze
我发现 Theano/Lasagne 的所有示例都处理像 mnist 和 cifar10 这样的小数据集,它们可以完全加载到内存中。 我的问题是如何编写高效的代码来训练大规模数据集?具体来说,为了让
我正在做图像分类,我必须检测图像是否包含飞机。 我完成了以下步骤: 1. 从图像数据集中提取特征作为描述符 2. 用 K 完成 - 表示聚类并生成描述符语料库 3.将语料数据在0-1范围内归一化并保存
一些简单的 theano 代码完美运行,当我导入 pymc3 时停止运行 为了重现错误,这里有一些片段: #Initial Theano Code (this works) import the
我在做this对于 NumPy 。 seq 是一个带有索引的列表。 IE。这实现了 1-of-k 编码(也称为 one-hot)。 def 1_of_k(seq, num_classes): nu
Keras 将数据批量加载到 GPU 上(作者注明here)。 对于小型数据集,这是非常低效的。有没有办法修改 Keras 或直接调用 Theano 函数(在 Keras 中定义模型之后)以允许将所有
Theano导入失败,theano配置cnmem = 1 知道如何确保 GPU 完全分配给 theano python 脚本吗? Note: Display is not used to avoid
例如,我可以定义一个递归 Python lambda 函数来计算斐波那契数列,如下所示: fn = lambda z: fn(z-1)+fn(z-2) if z > 1 else z 但是,如果我尝试
我是一名优秀的程序员,十分优秀!