简体   繁体   English

Python - 如何从 IDLE 与命令提示符运行模块

[英]Python - How to run module from IDLE vs. command prompt

I installed the moneywagon module using pip, for both python 2.7 and 3.4, and from the command prompt I can run commands, eg我使用 pip 为 python 2.7 和 3.4 安装了 Moneywagon 模块,并且从命令提示符我可以运行命令,例如

moneywagon service-table

and it gives the correct output.它给出了正确的输出。 But from IDLE python3.4, I tried但是从空闲 python3.4,我试过了

>>>>import moneywagon

or simply或者干脆

>>>>moneywagon service-table
SyntaxError: invalid syntax

I also tried我也试过

>>> from moneywagon import service-table
SyntaxError: invalid syntax

The commands are different for the command prompt and for the IDLE interface, for some reason.由于某种原因,命令提示符和空闲界面的命令是不同的。

In the documentation for moneywagon ( https://pypi.python.org/pypi/moneywagon ), there is a section entitled在 Moneywagon ( https://pypi.python.org/pypi/moneywagon ) 的文档中,有一个标题为

"# Python Interface" “#Python 接口”

which gives commands that work in IDLE.它给出了在 IDLE 中工作的命令。

Use import moneywagon.service-table .使用import moneywagon.service-table

You could also use import moneywagon.service-table as service-table .您也可以使用import moneywagon.service-table as service-table

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 IDLE 上运行特定于命令提示符的 python 库? - How do I run python libraries specific to command prompt on IDLE? Python 3.2.2在IDLE中运行时与在桌面上运行时的行为不同 - Python 3.2.2 IF behaves differently when run in IDLE vs. run from desktop 为什么这在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 命令行运行 Python 脚本? - How to run a Python script from IDLE command line? 如何从python shell或闲置命令运行.exe文件 - How to run .exe file with command from python shell or idle 从命令提示符下工作,但不是从python 2.7中的IDLE GUI工作 - working from command prompt but not from IDLE GUI in python 2.7 如何从 Windows 命令提示符启用“空闲”命令 - How to enable the "idle" command from Windows Command Prompt 如何使用 CMD 提示在 IDLE 中运行 python 脚本 - How to run a python script in IDLE using CMD prompt 如何从控制台运行python脚本,就像从命令提示符下调用一样? - how to run python script from the console as if called from command prompt? 如何从Windows命令提示符运行远程Python程序 - How to run a remote Python program from Windows command prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM