简体   繁体   English

由于 numpy,Python 脚本未与 Windows 任务调度程序一起运行

[英]Python script not running with Windows task scheduler due to numpy

Running a basic python script with the windows task scheduler only works when I comment out the import statement for numpy and I can't figure out why.仅当我注释掉 numpy 的导入语句并且我无法弄清楚原因时,才使用 windows 任务调度程序运行基本的 python 脚本。

Details:细节:

I was previously trying to run a more complex script but in order to narrow down the issues I was having I ended up creating the following basic script to test run with the task scheduler.我之前试图运行一个更复杂的脚本,但为了缩小我遇到的问题,我最终创建了以下基本脚本来测试使用任务调度程序运行。

import numpy

outDIR = "C:\\Users\\trill_gates\\OneDrive\\Documents\\DS Projects\\"

f = open(outDIR + "demofile2.txt", "w")
f.write("Test Text")
f.close()

Running the script normally does not produce any issues.正常运行脚本不会产生任何问题。 However, when I set it up to run with task scheduler, the file its supposed to write to isn't created.但是,当我将其设置为与任务调度程序一起运行时,不会创建它应该写入的文件。 Only when the import numpy statement is commented out does it work again.只有当import numpy语句被注释掉时,它才会再次起作用。 In the proper script I need run on a schedule, I'm using numpy and that seems to also be what was causing the script to not run.在我需要按计划运行的正确脚本中,我使用的是 numpy,这似乎也是导致脚本无法运行的原因。 I tried this on two separate computers, uninstalled and reinstalled anaconda as well as created a clean conda environment with just the necessary packages and I'm still getting the same error.我在两台不同的计算机上尝试了这个,卸载并重新安装了 anaconda 并创建了一个干净的 conda 环境,只包含必要的包,但我仍然遇到同样的错误。

This is the setup I'm using in task scheduler to call the script.这是我在任务调度程序中用来调用脚本的设置。

在此处输入图像描述

I'm using an anaconda distribution of python 3.7.7 and numpy 1.18.5.我正在使用 python 3.7.7 和 numpy 1.18.5 的 anaconda 分布。

Any help would be appreciated.任何帮助,将不胜感激。

I have something similar.我有类似的东西。 Updated to Python 3.7 yesterday and it seems to have killed the ability to execute scheduled tasks.昨天更新到 Python 3.7,它似乎已经杀死了执行计划任务的能力。 The error I get is numpy related even though the script doesn't use numpy.我得到的错误是 numpy 相关的,即使脚本不使用 numpy。 . . More shortly.很快。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM