简体   繁体   English

Python即使在路径中也无法运行

[英]Python Won't Run Even Through It Is In the Path

I have a SQL Server Agent job that executes some python scripts using CmdExec. 我有一个SQL Server代理作业,该作业使用CmdExec执行一些python脚本。 Everything is set up with a proxy account as expected. 一切都按预期设置了代理帐户。

When I run the job I get: 当我执行工作时,我得到:

Message Executed as user: domain\\proxyaccount. 以用户身份执行的消息:domain \\ proxyaccount。 'python' is not recognized as an internal or external command, operable program or batch file. 无法将“ python”识别为内部或外部命令,可操作程序或批处理文件。 Process Exit Code 1. The step failed. 进程退出代码1.步骤失败。

I'm using Anaconda and Python is in the system PATH variable. 我正在使用Anaconda,并且Python在系统PATH变量中。 When I run python from command line, it works. 当我从命令行运行python时,它可以工作。 When I run python cutting and pasting the specific command from the job, it works. 当我运行python剪切并粘贴作业中的特定命令时,它起作用了。 When I use runas to mimic the proxy account it works. 当我使用runas模仿代理帐户时,它可以工作。 The only place Python doesn't run is form inside the job. Python唯一不运行的地方是作业内部的表单。

What else do I need to look at to trouble shoot this issue? 要解决此问题,我还需要看什么?

You should restart SQL Server Agent after you installed Python on the server. 在服务器上安装Python之后,应重新启动SQL Server代理。

It is necessary for SQL Server Agent to load new environment variables, including the updated PATH with Python in it. SQL Server代理有必要加载新的环境变量,包括其中包含Python的更新的PATH。

There are also suggestions to restart SQL Server too, but I believe restarting SQL Server Agent will be enough. 也有建议重新启动SQL Server,但我相信重新启动SQL Server代理程序就足够了。

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

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