Directory Structure:
- /
- root
- var
- www
- ...
In /var/www, when I try to import a python module, let's say Library, located in /root/anaconda3/lib/python3.5/site-packages, it gives me an Internal Server Error.
But, it works well when I run the same script in the root directory.
How can I make it work in /var/www? Any suggestions?
Edit:
import Library
...
You need to add the path to your 'Library' to your Pathon search path. You can do this from within you Python script.
import sys
sys.path.append('/root/anaconda3/lib/python3.5/site-packages')
import Library
Also you can add the path to your PYTHONPATH environment variable.
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