简体   繁体   English

为什么我不能从Windows命令提示符运行python脚本?

[英]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.

相关问题 为什么我不能从命令提示符运行 python 代码? - Why can't I run python code from my command prompt? 如何在Windows 10中从常规命令提示符处激活python anaconda并运行脚本 - How do I activate python anaconda and run script from regular command prompt in Windows 10 为什么这在Python IDLE shell中有效,但在我从命令提示符下作为Python脚本运行时却没有? - Why does this work in the Python IDLE shell but not when I run it as a Python script from the command prompt? IDLE 找不到我的模块,但是当我从命令提示符运行脚本时它确实找到了 - IDLE can't find my modules but when I run script from command prompt it does Python:从python脚本的Windows命令提示符中执行windows命令 - Python: Executing the windows command in windows command prompt from python script 无法在命令提示符下运行Python代码 - Can't run Python code in Command Prompt 是否可以从Windows命令提示符运行python脚本并同时为该脚本传递参数? - Is it possible to run a python script from the windows command prompt and pass an argument for that script at the same time? 为什么 python 脚本在 pycharm 中运行和在命令提示符下运行时的行为不同? - Why does a python script behaves differently when it is run in pycharm and when it is run from a command prompt? 在 Anaconda 命令提示符中运行 Python 脚本的 Windows 快捷方式 - Windows Shortcut to Run Python Script in Anaconda Command Prompt 如何在命令提示符Windows 10中运行python脚本 - How to run python script in Command Prompt Windows 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM