簡體   English   中英

你如何在Windows PowerShell中打開一個notepad ++ python文件?

[英]How do you open a notepad++ python file in windows powershell?

我目前正在通過Zed Shaw的“學習Python困難之路”這本書學習python。 我現在學習了windows powershell的功能,我正在學習其他課程。 (在第1課)

聽起來很傻我在Windows PowerShell中打開一個保存的python notepad ++文件時遇到了麻煩。 我正在使用命令:

python ex1.py 

該文件與python和notepad ++一起保存到我的桌面 該文件是一個保存的記事本++文件,它應該在powershell中運行並打印我寫的內容(“hello world”)。 相反,我收到此錯誤消息:

python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included. verify if the path is correct and try again.

所以在Zed Shaw的書中,它在powershell中運行程序。 也許我的路走了?

Windows無法將“python”識別為有效命令(基於錯誤消息)。 你需要修復你的路徑。

  1. 找到python程序的安裝位置
  2. 將其添加到您的系統路徑
  3. 刷新你的shell

明確輸入路徑..

c:\\ Python27 \\ python.exe foo.py

(從長遠來看,它是否會以更好的方式)。

暫無
暫無

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

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