Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell脚本在Python中运行时无法正常工作_Python_Python 2.7_Powershell - Fatal编程技术网

Powershell脚本在Python中运行时无法正常工作

Powershell脚本在Python中运行时无法正常工作,python,python-2.7,powershell,Python,Python 2.7,Powershell,在Powershell界面中,我运行了以下命令: PS C:\Users\administrator.HYPERV>导入模块故障转移群集 PS C:\Users\administrator.HYPERV>获取模块-列表可用 我可以在结果中看到模块故障群集 但当我运行Python代码时: >>> os.system(r"powershell import-module FailoverClusters") 它给了我这个: 导入模块:未加载指定的模块“FailoverCluste

在Powershell界面中,我运行了以下命令:

PS C:\Users\administrator.HYPERV>导入模块故障转移群集

PS C:\Users\administrator.HYPERV>获取模块-列表可用

我可以在结果中看到模块故障群集

但当我运行Python代码时:

>>> os.system(r"powershell import-module FailoverClusters")
它给了我这个:

导入模块:未加载指定的模块“FailoverClusters” 因为在任何模块目录中都找不到有效的模块文件

然后我跑了

>>> os.system(r"powershell get-module -listAvailable")
结果中未显示模块故障群集


如何使这些python代码按预期工作?

将PowerShell更新到v3.0或更高版本,它将自动导入所需的模块。请尝试此PowerShell命令
[Environment]::Is64BitProcess
直接来自PowerShell和Python。将PowerShell更新到v3.0或更高版本,它将自动导入所需的模块。请尝试此PowerShell命令
[Environment]::Is64BitProcess
直接来自PowerShell和Python。