Solving “Importerror no module named”

So you’re trying to get something done and you’ve found an awesome tool to install via pip. You pop open Terminal, run your pip install command (in my case, pip install google_images_download), install the module successfully, and are ready to get to work. You start working on your Python script and get an error:

ImportError: No module named google_images_download

Well, that doesn’t make sense, you just installed it.
Turns out, it may not have been installed in the right place.

Solution

I found my solution here: https://stackoverflow.com/questions/32680081/importerror-after-successful-pip-installation

Basically, put python -m before your pip install command.

I also had to set up pip directly in my python environment using this command python -m ensurepip --upgrade --user

https://pip.pypa.io/en/latest/installation/

Final Set of Commands

python -m ensurepip –upgrade –user

python -m pip install google_images_download –user

No more errors. Nice!

Leave a Reply

Your email address will not be published. Required fields are marked *