简体   繁体   English

Python没有被Powershell调用

[英]Python not getting invoked by Powershell

I am working on some automation where a python script need to be executed by a PowerShell script.我正在研究一些自动化,其中 python 脚本需要由 PowerShell 脚本执行。 If I execute the python from the PowerShell (eg, ISE), it all works fine.如果我从 PowerShell(例如 ISE)执行 python,一切正常。 In the actual flow, the PowerShell function is first executed by the Application which uses this PowerShell script, which in turn must invoke the python script being called in that PowerShell function.在实际流程中,PowerShell 函数首先由使用此 PowerShell 脚本的应用程序执行,而后者又必须调用在该 PowerShell 函数中调用的 Python 脚本。

However, every time App executes this PowerShell, the python is not being invoked at all.但是,每次 App 执行此 PowerShell 时,根本不会调用 python。 The Environment variables are also set properly.环境变量也设置正确。 Not sure where to look for errors.不知道在哪里寻找错误。 Any leads ?有什么线索吗?

I am simply calling the python script as:我只是将python脚本称为:

py "C:\Program Files\<some location>\script.py" $arg1 $arg2

which error you are getting?你得到哪个错误?

can you elaborate more?你能详细说明一下吗?

have you tried with "python" instead你试过用“python”代替

My bad.我的错。 I guess i should have done a bit more troubleshooting.我想我应该做更多的故障排除。 The issue was because of a Python module which was not installed for all user (including the one which application uses to invoke the script).问题是由于没有为所有用户安装的 Python 模块(包括应用程序用来调用脚本的模块)。 Once installed, it works fine.安装后,它工作正常。

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

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