简体   繁体   中英

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

I am currently learning python through the book Learn Python the Hard Way by Zed Shaw. I learned the functions of windows powershell now im moving onto the other lessons. (on lesson 1)

As silly as it sounds i am having trouble opening a saved python notepad++ file in windows powershell. I am using the command:

python ex1.py 

The file is saved to my desktop along with python and notepad++. The file is a saved notepad++ file and it is supposed to run in powershell and print what i wrote ("hello world"). Instead I get this error message:

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.

So in the book when Zed Shaw does it it runs the program in powershell. Maybe my path is off?

Windows doesn't recognize "python" as a valid command (based on the error message). You need to fix your path.

  1. Find where your python program is installed
  2. Add it to your system path
  3. Refresh your shell

Enter the path explicitly..

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

(Do it wade's way it's nicer in the long run).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM