I have tried to run the Github: https://github.com/atbaker/wikipedia-question-generator
I have created the virtual environment using the following instruction: https://github.com/atbaker/wikipedia-question-generator#installing-with-python-34
$ pyvenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ python -m textblob.download_corpora
Install the command line tool so you can use the tool easily:
$ pip install -e folder_name
Now the environment is completed. My code ran properly on the commandline using the following:
wikitrivia 'tony'
Now I have tried to use it using php shell
script as follows:
<? php
$out = shell_exec('wikitrivia "tony" ');
echo $out;
?>
But there is nothing on the output screen. I tried to run the command php -v
and have shown the version. But the command wikitrivia "tony"
is not working. I am using AWS Ubuntu environment.
My php
version is 7 and the python
version is 3.5
Hope this helps. Kindly, let me know what I can do?
I did it recently as a cron task. You need to execute script from working dir with interpreter from venv. Somethin like that:
<? php
$out = shell_exec('cd FULL_YOUR_PYTON_WORKING_DIR && YOUR_VENV/bin/python FULL_PATH_TO_YOUR_SCRIPT.py "tony"');
echo $out;
?>
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.