简体   繁体   中英

How to run .py files on Windows/Anaconda terminal?

So I installed Anaconda on my computer, and use Jupiter notebook to write a script.

I have some.py files I want to run from Windows or Anaconda Terminal, just out of curiosity.

Here are the error message I got -

C:\Users\xxx\Documents>python ex1.py 'python' is not recognized as an internal or external command, operable program or batch file.

Is there a way that I can run python on Windows without messing up the path?

I guess you are using Command prompt to parse python files.

  • Open Anaconda Prompt ,
  • navigate to the folder containing your python files cd c:\path\to\python\folder
  • execute using python ex1.py where ex1.py is your filename

in the anaconda terminal

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