Matan
Matan

Reputation: 332

can't import facebook api to python code

i want to use graph api on python so i can do analysis on posts. so far i tried to import the library:

import facebook

but i got the error

import facebook
  File "C:\Users\matan\Desktop\Machine Learning Forex\facebook.py", line 11
    pip install -e git+https://github.com/mobolic/facebook-sdk.git#egg=facebook-sdk
              ^
SyntaxError: invalid syntax

  File "C:\Users\matan\Desktop\Machine Learning Forex\facebook.py", line 11
    pip install -e git+https://github.com/mobolic/facebook-sdk.git#egg=facebook-sdk
              ^
SyntaxError: invalid syntax

how can i import this library?

Upvotes: 2

Views: 11158

Answers (1)

MD. Khairul Basar
MD. Khairul Basar

Reputation: 5110

You are getting this error because you didn't install the package. Run this command to install the package - pip install facebook-sdk

Or if you are using python 3 better to run - pip3 install facebook-sdk

After installing import the package - import facebook

N.B: It's better to install released versions.

Upvotes: 7

Related Questions