I installed lighttpd and python-pip3 and then I installed a pip package (in this case, the requests
package). Then I tried to use it on a web page (served through CGI) and it did not work; I got an HTTP 500 error.
I wrote a short script to list all the modules that are available to the CGI scripts, and it does not include the pip package.
#!/usr/bin/python
import cgi
import cgitb
import sys
sys.path.insert(0, '/home/user/.local/lib/python3.7/site-packages')
cgitb.enable() # for troubleshooting
for m in sys.modules:
print(m)
What am I missing here? How can I make the package available to the CGI? It obviously is available through the command line (i.e. import requests
works without an issue when in the command line).