Graphlab创建SArray应用AttributeError:'module'对象没有属性'connect'

时间:2014-07-31 08:48:17

标签: python attributeerror graphlab

我在向Graphlab Create(python)中的SArray对象中的值应用函数时遇到了问题。文档中给出的示例甚至不适合我。

sa = SArray([1,2,3,4,5])
sa[sa.apply(lambda x: math.log(x) <= 1)]

返回以下内容:

RuntimeError: Runtime Exception: 0. Runtime Exception: 0. Traceback (most recent call last):
File "/usr/lib/python2.7/pickle.py", line 1382, in loads
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1124, in find_class
__import__(module)
File "/Library/Python/2.7/site-packages/graphlab/__init__.py", line 7, in <module>
import graphlab.connect.aws as aws
AttributeError: 'module' object has no attribute 'connect'

1 个答案:

答案 0 :(得分:2)

这可能是因为在机器上安装了多个Python(__import__通过pickle似乎与常规Python导入的工作方式不同,可能会尝试从不同的路径加载模块。)

解决方法是在virtualenv中运行,在virtualenv中使用graphlab-create的pip安装。这应该将Python模块加载隔离到正确的Python安装和模块路径。