I have this import in python code
import time
import sys
from pyvirtualdisplay import Display
from selenium import webdriver
when I run it from centos consol it runs correctly without any error.
Then I created a php file to run the python script with exec php function, and when I run it from centos consol, it runs correctly too, but when I run it from the browser it gives me this error
from pyvirtualdisplay import Display ImportError: No module named pyvirtualdisplay
I tried to give apache the right of executing the python file, but still the same problem.
Any idea about how to fix it?
To be accessible from web server your modules must be installed either:
sudo pip install pyvirtualdisplay
;pip --user install pyvirtualdisplay
under apache
user;pip install pyvirtualdisplay
; the script then must be executed with python from that virtual environment; use #!/path/to/venv/bin/python
as shebang for your scripts.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With