Run Python from PHP Windows 10

0

I have downloaded python 2.7 and it has been installed in C: \ python27

I created "MyPython.py":

def saludar(): 
 print "Que alegria que alboroto otro perrito piloto"


saludar()

If I run it in the folder C: \ python27 it works if I put it in another site it does not work ... the CMD says:

No se reconoce el comando interno o externo, 

And the other question: With that file in C: \ python27 in my PHP I have:

   shell_exec('C:\Python27\python.exe C:\Python27\MiPython.py') ; 

   tambien he probado con:

   shell_exec('C:\Python27\MiPython.py');

Basically I want PHP to open the cmd and say that and not have to be in the path of C: \ Python27 \ but I can not ...

    
asked by EduBw 29.10.2017 в 19:27
source

1 answer

0

Most likely, when you installed Python, you did not add it to the path.

For me the most practical thing is that you de-install it and reinstall it by selecting this option.

    
answered by 29.10.2017 в 22:51