The key line:
$rad=exec("python test.py".$values);
``
shouldn't be concatenated. The period should be a comma. Also, you don't need python before test.py. You do need the filepath, however. Also, you may want to try shell_exec() instead of exec() because that will just return a string, and you can print out the string to see what you are getting. See below:
$rad = shell_exec('/home/path/path/path/RELATE/main.py')
Separately, this question is similar to the one you are asking and gives you a separate way to get PhP to talk to Python using a text file as an intermediary. The benefit of this is that it would at least help you identify whether you have a PhP problem or a Python problem when there is a bug in your code.
https://stackoverflow.com/q/47981370/9807545
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…