I'm having a tough time finding a website that clearly explains how to import python modules without errors. I have a file called coffee_shop.py
in a directory called ~/Desktop/programming_feb_23_v
.
When I tried to run it, I would get the python import error from the googlemaps package. I downloaded the package directly "googlemaps-2.1.1.tar.gz" - I unzipped it and put the googlemaps dir directly in the same directory as the scrape_google.py
program (as well as all the other directories that came as child directories of googlemaps-2.1.1).
When I tried re-running python, I got "requests" module not found error. I then tried downloading the requests module and put that in the same folder as __init__.py
for googlemaps. It still seems to think I don't have the request file, even though I have that directory and it has an __init__.py
file in it, I still have a problem when trying to run the file.
Is there a smarter way to do this? I was reading about Python paths, but still not entirely sure what that means. For reference, I have printed my sys.path
. I'm wondering if there is a way I can just put all my python packages in one place (a lib?) and not have to manually download packages every time I want to run them.
Actionable Questions: - How do I set up my imports so I can (1) run this program and (2) not have to manually download them every time?
Other Notes = I'm running Python 2.7
EDIT - tried installing a virtual env and still couldn't get the program to run, even though it says it's installed.
EDIT v2 -
EDIT v3: Still having trouble getting GoogleMaps project to work
EDIT v4: Started from scratch with a venv following directions from http://docs.python-guide.org/en/latest/dev/virtualenvs/