【问题标题】:IPython Shell Commands in PowerShellPowerShell 中的 IPython Shell 命令
【发布时间】:2017-03-16 00:58:53
【问题描述】:

我想通过 Windows PowerShell 命令使用 IPython 的 shell 命令功能 !,但很多似乎都不起作用。具体来说,当我从 PowerShell 启动 IPython 时,我想使用常用的 Powershell 命令,方法是使用 ! 转义它们,就像我在 bash 中所做的那样。但是,例如,!cat!ni!rm!cp 都返回错误,

'<command>' is not recognized as an internal or external command
operable program or batch file.

为什么这些在 PowerShell 中不起作用,我该如何解决?

【问题讨论】:

    标签: powershell ipython


    【解决方案1】:

    IPython“!”语法显然调用 CMD.EXE,而不是 PowerShell。您将需要显式调用 Powershell,可能是 !powershell -command {&lt;insert-your-command-here&gt;},但如果 IPython 没有记录,确切的语法(包括任何必需的引用)将需要反复试验。请参阅the MSDN page for PowerShell command line parameters 了解更多信息。

    【讨论】:

    • 有没有办法将! 语法切换到PowerShell?另外,如果! 调用 CMD,你知道为什么在 MinGW 中从 bash 运行 IPython 时这些命令会起作用吗? IPython 是否知道切换到 bash 命令?
    • @bcf - 更准确地说,“!”语法显然调用了环境的默认 shell - 对于没有仿真的 Windows,它将是 CMD;对于 Linux 或 Linux 仿真,它将是默认的 shell,通常是 bash。我不使用 IPython,因此您需要检查文档以查看 !可以更改。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多