【问题标题】:Run Python Shell from Windows CMD (bypass cygwin)从 Windows CMD 运行 Python Shell(绕过 cygwin)
【发布时间】:2012-03-30 16:45:37
【问题描述】:

我在我的 win 7 电脑上安装了 cygwin。当我运行 python shell 时,我将操作系统名称设为 posix(这是预期的),并且许多 DOS 命令无法使用 os.system("DOS command")

有没有办法避免从 Windows 命令提示符进入 posix shell?

【问题讨论】:

  • Python安装开始菜单项调用Python(命令行)或Python Interactive Shell,你试过了吗?

标签: python windows cygwin


【解决方案1】:

您需要运行本机 Windows Python 解释器而不是 Cygwin 端口。

假设您已经在系统上安装了这两个版本,请检查您的 PATH 设置以确认本机 Windows 版本首先出现。

如果这对您不起作用,并且您宁愿运行 Cygwin 端口,那么您将不得不避免 os.system() 调用,而是改用新的子进程包。阅读http://docs.python.org/library/subprocess.html

【讨论】:

    猜你喜欢
    • 2013-03-22
    • 1970-01-01
    • 2011-07-12
    • 2012-11-11
    • 2011-07-28
    • 2016-09-25
    • 1970-01-01
    • 1970-01-01
    • 2013-02-16
    相关资源
    最近更新 更多