简体   繁体   中英

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. Everything is set up with a proxy account as expected.

When I run the job I get:

Message Executed as user: domain\\proxyaccount. 'python' is not recognized as an internal or external command, operable program or batch file. Process Exit Code 1. The step failed.

I'm using Anaconda and Python is in the system PATH variable. When I run python from command line, it works. When I run python cutting and pasting the specific command from the job, it works. When I use runas to mimic the proxy account it works. The only place Python doesn't run is form inside the job.

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.

It is necessary for SQL Server Agent to load new environment variables, including the updated PATH with Python in it.

There are also suggestions to restart SQL Server too, but I believe restarting SQL Server Agent will be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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