python import fails when called from PHP

前端 未结 4 652
长情又很酷
长情又很酷 2020-12-21 00:17

I\'m having a puzzling problem when trying to import a module in python only when the script is called from php via system or exec.

From the python shell:

         


        
4条回答
  •  时光取名叫无心
    2020-12-21 00:59

    Is the igraph module in Python's standard module path, or is it in the same directory as your individual script? If so, it's quite possible that PHP is calling the python file with a different working directory, and it's trying to import things relative to that path instead of the path of the script.

提交回复
热议问题