[英]Invoke server with PowerShell to run python script: can't open file [Errno 13] Permission denied
[英]Can't run python script with an txt entry in powershell [Errno 22]
我已經安裝了 python 3.7,我真的很陌生,讀到你可以在 PowerShell 中運行一個帶有 txt 條目的腳本(已經做了環境路徑配置)。 我打開 PowerShell 並輸入: - cd [Python 腳本目錄] - python main_1.py
它應該運行但返回一個錯誤,這是錯誤。 任何幫助將不勝感激。
Windows Powershell中未實現輸入重定向(命令行操作符<
)。 如果需要此功能,則可能需要切換到cmd.exe
。
您必須使用完整路徑
open(r"C:\description_files\program_description.txt","r")
還是相對路徑
open("program_description.txt","r")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.