I thought I throw together a little dirty script on our server (Ubuntu 16.04) that gives me some plain text output from Python.
I want to call the script like this from PHP (I know there should be some escaping done, but it's just a test currently):
<?php
$command = '/usr/local/bin/script.py';
$output = shell_exec($command);
echo $output;
?>
This is script.py
owned by www-data mode 774
#!/usr/bin/python
import CoolProp.CoolProp as CP
import argparse
print('Hallo Welt')
If I comment out the CoolProp
import it works. But somehow the package cannot be reached by www-data
and so the script returns nothing.
As you see I want to use the Package CoolProp
.
- So I tried installing it with
pip install CoolProp
=> That works for my local user. But now when called from userwww-data
- After I tried to install it with a target
--target=/usr/local/lib/site-packages/
but that did not help. - I tried to change the ACL on the complete
site-packages/
torwx
for www-data but that does not work as well.
In the end: What is the simplest way to pip install
a package that can be used by all users including www-data
?