希望這應該很簡單。如果我手動打開PowerShell v3,Python環境運行正常。我可以檢查版本並運行外部腳本等。但是,只要通過subprocess.Popen從另一個應用程序的python腳本打開powershell.exe,python就不會運行; 「術語」Python「不被識別爲cmdlet,函數,腳本文件或可操作程序等的名稱......」python在用Popen打開時無法在powershell v3中訪問
我已經重複檢查了我的環境路徑,python在系統上運行良好。
任何人都知道這可能是由什麼造成的?
subprocess.Popen(["powershell.exe", '-ExecutionPolicy', 'RemoteSigned', "path to PS1_script_with python command"])
我的PS1文件看起來像這樣:
cd C:\Users\David\Geeknote\geeknote-master\geeknote
python gnsync.py --path "C:\Users\David\Desktop\C4DtoEvernote", --mask "*.nfo", --notebook "Python Logs"
function Pause{Read-Host 'You have successfully synced your C4D Annotations to Evernote using gnsync.
Please press Enter to continue...' | Out-Null}
Pause{}
謝謝是的#3作品;)感覺有點昏暗我沒有想到這一點,但我顯然是撞我的頭撞牆。關於#1語法在那裏是完全正確的,還是應該有分號?我曾嘗試過,但它似乎刪除了我之前在那裏的一些路徑命令。它沒有解決問題。 #2我不知道如何實現。 – dflamholc