Python 3.x 运行Python脚本的Windows任务计划程序
我使用VS代码来执行python代码。我想自动执行此windows任务计划程序, 然而,我得到了一个错误 从VSCode这是我运行脚本时在终端上看到的Python 3.x 运行Python脚本的Windows任务计划程序,python-3.x,pandas,numpy,windows-task-scheduler,Python 3.x,Pandas,Numpy,Windows Task Scheduler,我使用VS代码来执行python代码。我想自动执行此windows任务计划程序, 然而,我得到了一个错误 从VSCode这是我运行脚本时在终端上看到的 Loading personal and system profiles took 712ms (base) PS C:\Users\tableauautomation\Desktop\Python> & 'C:\Users\tableauautomation\Anaconda3\python.exe' 'c:\Users\tab
Loading personal and system profiles took 712ms
(base) PS C:\Users\tableauautomation\Desktop\Python> & 'C:\Users\tableauautomation\Anaconda3\python.exe' 'c:\Users\tableauautomation\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\lib\python\debugpy\launcher' '64388' '--' 'c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py'
job Started: 2020-07-26 18:13:30
我是在记事本中创建的,另存为bat,但不断出现错误,如未安装Numpy或Panda
batchfile有这样的功能;
呼叫激活我的环境
“c:\Users\tableauautomation\Desktop\Python\Forecastation.py”
停顿
其他任何人都有这个问题,解决方案就在这里; 批处理文件需要以下参数(Windows计算机) cmd/c:\Users\tableauautomation\Anaconda3\condabin\conda.bat运行“c:\Users\tableauautomation\Anaconda3\python.exe”“c:\Users\tableauautomation\Desktop\python\ForecastAutomation.py”
暂停用
.bat
格式在记事本中写下以下几行
call activate [my_env]
python c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py
call conda deactivate
如果python的绝对路径未包含在$path
中,则在.bat
文件中使用python.exe的绝对路径
call activate [my_env]
c:\Users\tableauautomation\Anaconda3\python.exe c:\Users\tableauautomation\Desktop\Python\ForecastAutomation.py
call conda deactivate