问题
I want to run my Python script using PHP's shell_exec() and xammp on Mac. When I run it on terminal it is working, but when I run it on browser it shows this error 'sh: 1: python3: not found'
PHP
$command = escapeshellcmd("python3 scrape.py");
$command_output = shell_exec($command." 2>&1");
echo $command_output;
Python
#!/usr/bin/env python3
import cgi,cgitb
import urllib.request
from bs4 import BeautifulSoup
from bs4.element import Comment
from datetime import datetime
import re
import json
print ("Content-Type: text/plain;charset=utf-8\n")
print("hello")
来源:https://stackoverflow.com/questions/55646460/how-to-debug-the-error-sh-1-python3-not-found-in-running-python-script-in-p