简体   繁体   English

Python Scikit 学习脚本在 Windows 任务调度程序中崩溃

[英]Python Scikit learn script crashing in Windows Task Scheduler

I have a python script using Scikit-learn libraries and it works completely fine when I run it manually in either Jupyter notebook or command line.我有一个使用 Scikit-learn 库的 python 脚本,当我在 Jupyter 笔记本或命令行中手动运行它时,它工作得很好。 However, it doesn't work when I schedule it in Windows Task Scheduler.但是,当我在 Windows 任务计划程序中安排它时,它不起作用。 After spending a lot of time I realised the issue is due to the sklearn imports.花了很多时间后,我意识到问题是由于sklearn导入造成的。 If I comment out the sklearn imports, the script works fine in the scheduler but the moment I include a sklearn import, the scheduler doesn't execute one line of the script.如果我注释掉 sklearn 导入,则脚本在调度程序中工作正常,但是当我包含 sklearn 导入时,调度程序不会执行脚本的一行。 I have no idea what is causing this and it's even more surprising that the script works like a charm when running it manually.我不知道是什么原因造成的,更令人惊讶的是,脚本在手动运行时就像一个魅力。 I've uninstalled and reinstalled Anaconda distribution on my PC but no result.我已经在我的 PC 上卸载并重新安装了 Anaconda 发行版,但没有结果。 Any help on how I can fix this please?请帮助我解决这个问题吗?

I finally managed to fix this.我终于设法解决了这个问题。 Turns out it's a corrupted scipy package.原来它是损坏的scipy package。 Uninstalling and re-installing it fixed the issue.卸载并重新安装它解决了这个问题。

The way I figured it out is by running my python script as a batch file which threw the following error我想出来的方法是将我的 python 脚本作为批处理文件运行,这会引发以下错误

from scipy.sparse.linalg import lsqr as sparse_lsqr从 scipy.sparse.linalg 导入 lsqr 作为 sparse_lsqr

ImportError: DLL load failed: The specified module could not be found. ImportError: DLL 加载失败:找不到指定的模块。

I never got this error when I ran my python script from the windows scheduler or Jupyter notebook or even command line, which is very strange.当我从 windows 调度程序或 Jupyter 笔记本甚至命令行运行我的 python 脚本时,我从未收到此错误,这很奇怪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 脚本 Windows 任务调度程序 - Python Script Windows Task Scheduler Windows Task Scheduler终止python脚本,操作码2 - Windows task scheduler terminates python script, opcode 2 Windows 任务计划程序,python 脚本,代码 2147942401 - Windows Task Scheduler, python script, code 2147942401 Python 脚本未在 Windows 任务计划程序中运行 - Python script not running in Windows Task Scheduler Python脚本已完成,但Windows Task Scheduler显示正在运行 - Python script completes, but Windows Task Scheduler shows running 由于 numpy,Python 脚本未与 Windows 任务调度程序一起运行 - Python script not running with Windows task scheduler due to numpy 在Windows Task Scheduler中运行的Python脚本以退出代码3221225477完成 - Python Script Running in Windows Task Scheduler Completes with exit code 3221225477 使用Windows任务计划程序安排[Virtualenv相关] Python脚本 - Schedule [Virtualenv Dependent] Python Script with Windows Task Scheduler 有没有一种方法可以让Windows任务计划程序自动响应Python脚本中的input()? - Is there a way to have Windows task scheduler automatically respond to input() in Python script? 无法安排 python 脚本通过 Windows 任务计划程序运行 - Cannot schedule a python script to run through Windows Task Scheduler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM