PHP + Python: Install python dependencies for python scripts

#from bash command line #first create folder to save python dependencies: > sudo mkdir /var/www/.local > sudo mkdir /var/www/.cache > sudo chown www-data.www-data /var/www/.local > sudo chown www-data.www-data /var/www/.cache # then install dependencies (imports): > sudo -H -u www-data pip install <dep1> > sudo -H -u www-data pip install <dep2> : # then set user permissions to run your script to www-data user: # creating a file at /etc/sudoers.d/: > sudo nano /etc/sudoers.d/mysudoerfile www-data ALL=(ALL) NOPASSWD: /usr/bin/python <path of your script here> # then set execute permissions to your script: sudo chmod +x <path of your script here> # then run your script

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.