Mục đích của trang này là để chứng minh cách truyền các đối số cho các tập lệnh Python thông qua các tập lệnh PowerShell. Trong Terminal PowerShell, bạn có thể gõ chúng theo nghĩa đen. Nhưng trong các tập lệnh PowerShell, bạn phải sử dụng các biến. Tôi cung cấp các ví dụ về các đối số vị trí cũng như các tùy chọn bằng cách sử dụng Argparse [việc thực hiện các đối số từ khóa nội bộ của Python].1. Đối số vị trí bằng cách sử dụng sys.argv trong mã Python
PowerShell WrapperPyThon Script sử dụng `` belete` arg được truyền qua PowerShellcfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe"
code00.py
Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32
Name Value
-- -- -- -- -
PSVersion 5.1 .18362 .145
PSEdition Desktop
PSCompatibleVersions {
1.0,
2.0,
3.0,
4.0...
}
BuildVersion 10.0 .18362 .145
CLRVersion 4.0 .30319 .42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1 .0 .1
Powershell returned: 0
Done.
9 để phân tích đối số để biểu thị hành vi không mặc địnhimport subprocess
subprocess.call["powershell .\test.ps1 177.241.87.103"]
0 để xóa thực tế qua APIimport subprocess
subprocess.call["powershell .\test.ps1 177.241.87.103"]
1 để thực hiện xóa hoặc import subprocess
subprocess.call["powershell .\test.ps1 177.241.87.103"]
2 cho bản vá mặc định2. Tùy chọn [đối số từ khóa] Sử dụng mô -đun ArgParse trong mã Python
trình bao bọc PowerShell có các đối số được đặt tên cho khóa và giá trị được sửa đổi các đối số phân tích tập lệnh python với mô -đun argparseimport subprocess
subprocess.call["powershell .\test.ps1 177.241.87.103"]
3 và import subprocess
subprocess.call["powershell .\test.ps1 177.241.87.103"]
4] là một phần của biến import subprocess
subprocess.call["powershell .\test.ps1 177.241.87.103"]
5Liên kết
code00.py:#!/usr/bin/env python3
import sys
import subprocess
def main[]:
cmd = ["PowerShell", "-ExecutionPolicy", "Unrestricted", "-File", ".\\script00.ps1"] # Specify relative or absolute path to the script
ec = subprocess.call[cmd]
print["Powershell returned: {0:d}".format[ec]]
if __name__ == "__main__":
print["Python {0:s} {1:d}bit on {2:s}\n".format[" ".join[item.strip[] for item in sys.version.split["\n"]], 64
if sys.maxsize > 0x100000000
else 32, sys.platform]]
main[]
print["\nDone."]
3._
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.
Gợi ý: 2
Tôi đang cố gắng chạy các tập lệnh PowerShell có các tham số từ Python 3.7.3, nhưng không biết cách gọi đúng hàm trong popen, nhưng bây giờ tôi muốn lấy python để chạy tập lệnh thử nghiệm này. . Tôi đã lưu kiểm tra.ps1, vào C: usersjgreen02 và và đến c: usersjgreen02desktop, những gì tôi đang cố gắng làm với tập lệnh PowerShell của mình về số lượng được xác định. Vì vậy, cách tôi có thiết lập tập lệnh PowerShell của mình, tôi vượt qua trong địa chỉ IP của bộ định tuyến như. Cả hai lệnh này đều hoạt động và nhận đầu ra chính xác và lưu đầu ra của chúng vào các tệp văn bản., Khi chạy tập lệnh, nó cần được truyền qua tùy chọn -File. Để biết thêm chi tiết, hãy kiểm tra [Ms.Docs]: Giới thiệu về PowerShell.exe [PowerShell /?]
import subprocess subprocess.call["powershell .\test.ps1 177.241.87.103"]
Traceback [most recent call last]: File "C:/Users/jgreen02/PycharmProjects/PortChecker/Platypus.py", line 43, in subprocess.call[["powershell test.ps1 10.238.241.38"]] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 323, in call with Popen[*popenargs, **kwargs] as p: File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 775, in __init__ restore_signals, start_new_session] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 1178, in _execute_child startupinfo] FileNotFoundError: [WinError 2] The system cannot find the file specified```
#!/usr/bin/env python3 import sys import subprocess def main[]: cmd = ["PowerShell", "-ExecutionPolicy", "Unrestricted", "-File", ".\script00.ps1"] # Specify relative or absolute path to the script ec = subprocess.call[cmd] print["Powershell returned: {0:d}".format[ec]] if __name__ == "__main__": print["Python {0:s} {1:d}bit on {2:s}n".format[" ".join[item.strip[] for item in sys.version.split["n"]], 64 if sys.maxsize > 0x100000000 else 32, sys.platform]] main[] print["nDone."]
cfati @CFATI - 5510 - 0: e: WorkDevStackOverflowq057115405] > "e:WorkDevVEnvspy_064_03.07.03_test0Scriptspython.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.
Gợi ý: 3
Sử dụng quy trình bắt đầu và tùy chọn -ArgumentList của nó để thực thi lệnh python [hoặc tập lệnh] truyền cho nó giá trị đối số mà lệnh python thực tế [hoặc tập lệnh] mong đợi. Đặt tham số -FilePath thành đường dẫn đầy đủ đến tệp python.exe trên Windows., Tôi có một môi trường Conda được kích hoạt trong dấu nhắc lệnh PowerShell. Tôi có một gói Python đã được cài đặt với PIP :, dường như đã giải quyết vấn đề đó, cảm ơn. Không quan tâm, tại sao tập lệnh không thể "xem" cùng một thực thi như dấu nhắc lệnh? - & NBSP; Ocelto ngày 16 tháng 2 lúc 18:04, Super User là một trang web câu hỏi và trả lời cho những người đam mê máy tính và người dùng quyền lực. Chỉ mất một phút để đăng ký.
Powershell
Start - Process - FilePath "C:\Program Files\Python\python.exe" - ArgumentList 'simulate "abcd"';
hoặc gọi một kịch bản Python
Start - Process - FilePath "C:\Program Files\Python\python.exe" - ArgumentList '"c:\scripts\simulate.py" "abcd"';
Gợi ý: 4
06/07/2022
Để khai báo các biến mới trong tập lệnh PowerShell, hãy sử dụng ký hiệu $. Để trả về các giá trị từ các hành động của Run PowerShell Script để Power Automate, hãy sử dụng lệnh Write-Output.$ notation. To return values from Run PowerShell script actions to Power Automate, use the Write-Output command.
$variableName = "variableValue" Write - Output $variableName
Các tập lệnh Python không yêu cầu bất kỳ ký hiệu đặc biệt nào để khai báo các biến mới. Để trả về các giá trị từ các hành động Run Python Script, hãy sử dụng hàm in.print function.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.0
VBScript không yêu cầu bất kỳ ký hiệu đặc biệt nào để khai báo các biến mới. Sử dụng hàm wscript.echo để trả về các giá trị từ các hành động VBScript để tự động hóa.WScript.Echo function to return values from Run VBScript actions to Power Automate.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.1
Trong các tập lệnh JavaScript, sử dụng ký hiệu VAR để khai báo các biến mới và hàm wscript.echo để trả về các giá trị từ các hành động chạy JavaScript.var notation to declare new variables and the WScript.Echo function to return values from Run JavaScript actions.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.2
Gợi ý: 5
Ngày 27 tháng 6 năm 20221 0
Tôi cần phải tìm ra một cách để tải động cơ PowerShell. Đầu tiên, có một vài yêu cầu để làm cho tất cả hoạt động này. DotNet phải có sẵn, cũng như PowerShell và
import subprocess subprocess.call["powershell .\test.ps1 177.241.87.103"]6 cung cấp một cách để chỉ định nơi tìm kiếm dotnet. Đặt biến môi trường
import subprocess subprocess.call["powershell .\test.ps1 177.241.87.103"]7 thành vị trí cài đặt, cho phép
import subprocess subprocess.call["powershell .\test.ps1 177.241.87.103"]6 tìm cách tìm các cụm và các tệp hỗ trợ khác để lưu trữ .NET.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.3
Bây giờ chúng ta đã biết dotnet ở đâu, chúng ta cần tải lên CLR và thiết lập cấu hình thời gian chạy. Cấu hình thời gian chạy mô tả các khía cạnh khác nhau về cách chúng tôi chạy. Chúng ta có thể tạo ra một
import subprocess subprocess.call["powershell .\test.ps1 177.241.87.103"]9 rất đơn giản
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.4
Sự kết hợp của
import subprocess subprocess.call["powershell .\test.ps1 177.241.87.103"]7 và cấu hình thời gian chạy cho phép tải CLR với các hàm
Traceback [most recent call last]: File "C:/Users/jgreen02/PycharmProjects/PortChecker/Platypus.py", line 43, in subprocess.call[["powershell test.ps1 10.238.241.38"]] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 323, in call with Popen[*popenargs, **kwargs] as p: File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 775, in __init__ restore_signals, start_new_session] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 1178, in _execute_child startupinfo] FileNotFoundError: [WinError 2] The system cannot find the file specified```1 và
Traceback [most recent call last]: File "C:/Users/jgreen02/PycharmProjects/PortChecker/Platypus.py", line 43, in subprocess.call[["powershell test.ps1 10.238.241.38"]] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 323, in call with Popen[*popenargs, **kwargs] as p: File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 775, in __init__ restore_signals, start_new_session] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 1178, in _execute_child startupinfo] FileNotFoundError: [WinError 2] The system cannot find the file specified```2.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.5
Gợi ý: 6
. Cách tiếp cận :, [python.docs]: sub crocess.call [args, *, anycodings_command-line stdin = none, stdout = none, stderr = none Các đối số được hiển thị ở trên chỉ đơn thuần là anycodings_command-line một số thông thường. Chức năng đầy đủ Chữ ký bất kỳ Là một chuỗi bất kỳ
Nhưng bây giờ tôi muốn nhận được Python để chạy tập lệnh AnyCodings_PowerShell "test.ps1" với tham số. Tôi đã lưu bất kỳanycodings_powershell "test.ps1" script with the parameter. I've anycodings_powershell saved "test.ps1" to "C:\Users\jgreen02" and anycodings_powershell to "C:\Users\jgreen02\Desktop"
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.6
Đầu ra lỗi là:
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.7
code00.py:
#!/usr/bin/env python3 import sys import subprocess def main[]: cmd = ["PowerShell", "-ExecutionPolicy", "Unrestricted", "-File", ".\\script00.ps1"] # Specify relative or absolute path to the script ec = subprocess.call[cmd] print["Powershell returned: {0:d}".format[ec]] if __name__ == "__main__": print["Python {0:s} {1:d}bit on {2:s}\n".format[" ".join[item.strip[] for item in sys.version.split["\n"]], 64 if sys.maxsize > 0x100000000 else 32, sys.platform]] main[] print["\nDone."]
3._
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.
Gợi ý: 7
Tên của chức năng của bạn. Bạn phải đảm bảo hàm được xác định trong xử lý có hai tham số, sự kiện và bối cảnh. Thời gian chạy PowerShell không hỗ trợ tham số này., Chạy tập lệnh Python hoặc PowerShell được cung cấp bằng cách sử dụng thời gian chạy và xử lý được chỉ định. Mỗi AWS: Hành động thực thi có thể chạy đến thời lượng tối đa là 600 giây [10 phút]. Bạn có thể giới hạn thời gian chờ bằng cách chỉ định tham số TimeoutSeconds cho bước AWS: Executescript., Để gọi một tệp cho Python, hãy sử dụng định dạng fileName.method_name trong xử lý. Đối với PowerShell, hãy gọi tệp đính kèm bằng tập lệnh nội tuyến. GZIP không được hỗ trợ., Một tập lệnh được nhúng mà bạn muốn chạy trong quá trình tự động hóa. Tham số này không được hỗ trợ cho JSON Runbooks. JSON Runbooks phải cung cấp nội dung tập lệnh bằng tham số đầu vào đính kèm.
Để sử dụng các mô -đun lõi PowerShell không được cài đặt sẵn, tập lệnh của bạn phải cài đặt mô -đun bằng cờ
Traceback [most recent call last]: File "C:/Users/jgreen02/PycharmProjects/PortChecker/Platypus.py", line 43, in subprocess.call[["powershell test.ps1 10.238.241.38"]] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 323, in call with Popen[*popenargs, **kwargs] as p: File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 775, in __init__ restore_signals, start_new_session] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 1178, in _execute_child startupinfo] FileNotFoundError: [WinError 2] The system cannot find the file specified```3, như được hiển thị trong lệnh sau. Mô -đun
Traceback [most recent call last]: File "C:/Users/jgreen02/PycharmProjects/PortChecker/Platypus.py", line 43, in subprocess.call[["powershell test.ps1 10.238.241.38"]] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 323, in call with Popen[*popenargs, **kwargs] as p: File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 775, in __init__ restore_signals, start_new_session] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 1178, in _execute_child startupinfo] FileNotFoundError: [WinError 2] The system cannot find the file specified```4 không được hỗ trợ. Thay thế
Traceback [most recent call last]: File "C:/Users/jgreen02/PycharmProjects/PortChecker/Platypus.py", line 43, in subprocess.call[["powershell test.ps1 10.238.241.38"]] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 323, in call with Popen[*popenargs, **kwargs] as p: File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 775, in __init__ restore_signals, start_new_session] File "C:Usersjgreen02AppDataLocalProgramsPythonPython37-32libsubprocess.py", line 1178, in _execute_child startupinfo] FileNotFoundError: [WinError 2] The system cannot find the file specified```5 bằng mô -đun bạn muốn cài đặt.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.1
Amazon S3 CMDLET.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.2
Amazon EC2 CMDLET.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.3
Amazon S3 CMDLET.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.2
Amazon EC2 CMDLET.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.3
Các công cụ AWS độc lập, hoặc dịch vụ độc lập cho các CMDLET của Windows PowerShell.
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.6
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.7
cfati @CFATI - 5510 - 0: e: \Work\ Dev\ StackOverflow\ q057115405] > "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py Python 3.7 .3[v3 .7 .3: ef4ec6ed12, Mar 25 2019, 22: 22: 05][MSC v .1916 64 bit[AMD64]] 64 bit on win32 Name Value -- -- -- -- - PSVersion 5.1 .18362 .145 PSEdition Desktop PSCompatibleVersions { 1.0, 2.0, 3.0, 4.0... } BuildVersion 10.0 .18362 .145 CLRVersion 4.0 .30319 .42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1 .0 .1 Powershell returned: 0 Done.8