簡體   English   中英

無法打開文件 [Errno 2] 沒有這樣的文件或目錄

[英]Can't Open File [Errno 2 ] No such file or directory

我是編碼新手並嘗試使用代碼運行器在 vscode 中運行 python 代碼,但它不起作用,我認為問題是代碼運行器運行 C:\/c\/-------- 這不是存在於我的目錄中,但我不知道如何解決它。 我嘗試運行時的終端屏幕截圖<\/a>

終端代碼:

PS C:\Users\Kevin> python -u "/c/Users/Kevin/Desktop/Coding/Python/testing/hello.py"

C:\Python\Python39\python.exe: can't open file 'C:\c\Users\Kevin\Desktop\Coding\Python\testing\hello.py': [Errno 2] No such file or directory

你如何使用Code Runner<\/code>運行你的 python 文件?

通常,它應該是這樣的:

我無法重現代碼運行器自動采用以\/<\/code>或\\<\/code>開頭的路徑。 並且路徑以slash<\/code>而不是backslash<\/code>作為路徑分隔符。

你點擊這里運行python文件嗎?

您可以嘗試進入代碼運行器設置(@ext:formulahendry.code-runner),打開代碼運行器:執行器映射,在 Json 中編輯,然后將“code-runner.terminalRoot”值更改為“”,然后返回設置並取消標記在終端中運行框。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM