我已经安装了pyfacebook以及python 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'
答案 0 :(得分:1)
使用facebook
安装easy_install facebook
模块时出现此问题。当我运行以下内容时它起作用了:
git clone https://github.com/pythonforfacebook/facebook-sdk.git
pip install facebook-sdk