简体   繁体   中英

Can't open python programs from command prompt

When attempting to run .py files from the command prompt I get this,

C:\users\ocean>python helloworld.py
python: can't open file 'helloworld.py': [Errno 2] No such file or directory

The environment variables are already set to ;C\\python27 and ;C\\python32 (yes, I'm running both releases of python.)

Do I have to set a new variable? What must I do? Running Windows 7, it was a pain to get it to even run that error, before 'python' wasn't even recognized.

Edit: C:\\users\\oceans does not include my python folder. Is there anyway to redirect the directory so that I won't have to move all of the python files to ocean?

You have to either do:

python c:\path\to\the\file.py

or

cd c:\path\to\the
python file.py

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