简体   繁体   中英

Can't change Python version, wamp server

I'm using Wamp on Windows to host a server.

this is my php script to run a python script:

<?php 

$command = escapeshellcmd('script.py');
$output = shell_exec($command);
echo $output;

?>

This is my Python Script to check ver.

import sys
print(sys.version)

The print is == 3.0.1 (r301:69561, Feb 13 2009, 17:50:10) [MSC v.1500 64 bit (AMD64)]

The problem is i can't install pip,setup tools and requests on 3.0.1 .

So, i need to change the version to Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49)

i've tried to use "#!C:\\Users\\CLIENTE\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe" as shebang but, no effect. It keeps printing 3.0.1.

Any way to change the Python version that is running the script?

what you need to do is use a path to python before the path of .py script

Example:

$output = shell_exec('path\\to\\python path\\to\\script.py');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM