[英]Cannot run Python Script inside VSCODE terminal
我有同樣的問題,這個線程幫助我得到一個關於文件“<stdin>”的語法錯誤,第 1 行
You are now working inside your Python shell (>>>) while the code you are running (& python "FILENAME.py") is no Python, therefore syntax error.
exit()
退出 python shell 並返回 PowerShell 環境。
簡單地
python
再次進入,直接運行python代碼
您的 PATH 變量中似乎無法識別 python 。 我認為修復的兩種方法是找到您的 python 文件路徑並將其添加到您的用戶變量中:
或者,不確定這是開箱即用的,但您可以:
按照@mah111 的建議編輯 PATH 后,我需要重新啟動 VSCODE 應用程序
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.