简体   繁体   中英

Why can't I run a python script from the Windows Command Prompt?

I am attempting to use a python script made available by MrDoob's three.js; The script allows me to convert obj files into Binary code. The script; convert_obj_three.py is ran from the command line.

However, none of my attempts to open it have worked. I've de-installed, re-installed python (Yes it has PATH access) but no luck.

I am constantly bombarded by the Syntax Error Message. 错误快照

Does anybody know how to use the windows Command Prompt to execute Python files? If so, I'd really appreciate some guidance. Hopefully I'm not asking silly questions. If so.. Please just link me to the next best answer.

You are trying to run the command python convert_obj_three.py in Python, which is of course invalid Python syntax.

You should run python convert_obj_three.py straight from the command line, and not from the Python shell.

Open the cmd in the directory of the .py file and run python convert_obj_three.py arg1 arg2 ... .

You don't actually have to be in the directory of the file, but then you of course need to provide the full path:

python "C:\\some_path\\convert_obj_three.py" arg1 arg2 ...

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