GraphApi模块存在于pyfacebook或不(GraphApi module present

2019-09-22 12:14发布

我已经安装了pyfacebook以及蟒蛇SDK甚至我得到的错误如下

使用此代码时

import facebook
token = 'my token'
graph = facebook.GraphAPI(token)
profile = graph.get_object("me")
friends = graph.get_connections("me", "friends")
friend_list = [friend['name'] for friend in friends['data']]
print friend_list

    

我现在面临误差

graph = facebook.GraphAPI(token)
AttributeError: 'module' object has no attribute 'GraphAPI'

Answer 1:

当我安装我有这个问题, facebook使用模块easy_install facebook 。 它工作时,我跑,而不是执行以下操作:

git clone https://github.com/pythonforfacebook/facebook-sdk.git pip install facebook-sdk



文章来源: GraphApi module present in pyfacebook or not