I have a Python script (blah.py), where the first line is:
import scrapy
When I write "python blah.py" it works fine.
I have a .sh script:
#!/bin/bash
python blah.py
When I execute the .sh script with "sh blah.sh" I get the error:
ImportError: No module named scrapy
I can't figure out why. I want to execute it from within a .sh file because I am executing some other commands after the Python script.
Looks like you could be running both on different environments.
Check in terminal when running python blah.py
which python version you are using with which python
, and the same for the bash script, before the line of python blah.py
type which python
.
Make sure both paths are the same for them to work
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments