[英]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; 我正在尝试使用MrDoob的three.js提供的python脚本; The script allows me to convert obj files into Binary code.
该脚本允许我将obj文件转换为二进制代码。 The script;
剧本; convert_obj_three.py is ran from the command line.
从命令行运行convert_obj_three.py。
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.
我已经卸载了,重新安装了python(是的,它具有PATH访问权限),但是没有运气。
I am constantly bombarded by the Syntax Error Message. 我经常被语法错误消息轰炸。
Does anybody know how to use the windows Command Prompt to execute Python files? 有人知道如何使用Windows命令提示符执行Python文件吗? 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. 您正在尝试在Python中运行命令
python convert_obj_three.py
,这当然是无效的Python语法。
You should run python convert_obj_three.py
straight from the command line, and not from the Python shell. 您应该直接从命令行而不是Python Shell运行
python convert_obj_three.py
。
Open the cmd in the directory of the .py
file and run python convert_obj_three.py arg1 arg2 ...
. 在
.py
文件的目录中打开cmd,然后运行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 ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.