Reputation: 41
I am trying to create a project in python using some libraries from GitHub that I found. I am using InstaPy and Instagram-API-python. My project structure is as follows
How would I import both these into the insta.py file? I am new to python and not sure how the imports work.
Upvotes: 4
Views: 8607
Reputation: 8215
Don't copy them into your project folder, use pip
to install them on your Python path.
But first, read about virtual environments.
Once you have your virtual environment set up and activated you can install the packages thus:
$ pip install git+https://github.com/timgrossmann/InstaPy.git
$ pip install git+https://github.com/LevPasha/Instagram-API-python.git
Then, in your python script just import them
from instapy import InstaPy
import InstagramAPI
and use them.
I followed these instructions and it (mostly) worked. It looks like InstagramAPI
needs an executable installed (ffmpeg
) which I'm not wanting to install on my laptop. It reports the error during the initial import
.
I could definitely import instapy
.. but notice that it is all lower case.
But since there is only the InstaPy class in the instapy module, it's best to simply import it this way.
More on InstaPy here: https://github.com/timgrossmann/InstaPy
Upvotes: 3