使用asp.net核心进程执行的Python脚本。Start()找不到模块

2024-06-16 11:28:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我制作了一个web api,它通过使用c#Process.Start()运行python脚本。该脚本在localhost中工作时没有问题,但一旦我在IIS上部署并发布它,就会从python脚本中得到此错误

line 281, in apply_affine_transform    raise ImportError("Image transformations require SciPy. "ImportError: Image transformations require SciPy. Install SciPy.

我通过执行“pip list-v”检查了已安装的模块,果然,已经安装了scipy。然后,我通过cmd执行了脚本,它没有任何问题。我推测,只有通过c#Process.Start()执行python脚本时,才会出现这种情况

注意:错误在另一个导入的模块中抛出,具体如下:

C:\Users\Computer1\AppData\Local\Programs\Python\Python38\lib\site-packages\keras_preprocessing\image\affine_transformations.py\

谁能给我指出正确的方向吗

编辑: 我无法解决这个问题,但我找到了一个涉及anaconda(https://www.anaconda.com/)的解决方法,即使用Process.Start()在conda(base)环境中运行脚本


Tags: 模块image脚本apiweblocalhost错误anaconda