How to implement Python import libraries on Xampp localhost?

2guxujil  于 2022-10-22  发布在  Python
关注(0)|答案(1)|浏览(121)

I'm trying to implement running machine learning on my web. I set my Xampp addhandler .py so that can handle python files. Basically, I checked everything python works on my web. But the problem is that cannot import any libraries such as cv2, easyocr, and imutils.


# !C:\Users\parkc\AppData\Local\Programs\Python\Python310\python.exe

print("Content-type: text/html\n")
import cv2
import numpy as np
import imutils
import easyocr
from matplotlib import pyplot as plt

print("Hello World")

And this is my result page, result page Nothing shows. So, what I doubt is that it can't load libraries from localhost. Because if I set the code like,


# !C:\Users\parkc\AppData\Local\Programs\Python\Python310\python.exe

print("Content-type: text/html\n")
print("Hello World")
import cv2
import numpy as np
import imutils
import easyocr
from matplotlib import pyplot as plt

Then, it prints Hello World very well! I'm googling for 2 days to solve this problem. But totally cannot get what's the problem. Is it not possible to use package libraries on web? My web server is Apache Xampp.

ohtdti5x

ohtdti5x1#

Maybe you would like to read this, it will help you a lot I think: the article
“How to Easily Run Python Visualizations On a Web Browser with PyScript”

相关问题