简体   繁体   English

在Windows的Jupyter Notebook中运行Linux命令时出错

[英]Error while running Linux commands in Jupyter notebook on windows

I have been studying pandas for python. 我一直在研究python的pandas。 I am doing my practical work on Jupyter Notebook. 我正在Jupyter Notebook上进行实际工作。 I tried running few Linux commands in Jupyter notebook and the result is shown below: 我尝试在Jupyter笔记本中运行一些Linux命令,结果如下所示:

在此处输入图片说明

As you can see I am able to run ls Command but not able to run cat command. 如您所见,我能够运行ls Command,但不能运行cat命令。 I tried Executing cat command like !cat but then it gets unrecognized as it's shown below: 我尝试了执行!cat类的执行cat命令,但如下图所示,它变得无法识别:

在此处输入图片说明

From the screenshots one can see, that IPython is part of the error messages. 从屏幕截图中可以看到,IPython是错误消息的一部分。 Jupyter notebook is using IPython in the background when you are in Windows and running these commands. 在Windows中, Jupyter Notebook在后台使用IPython并运行这些命令。

IPython documentation about magic commands: IPython有关魔术命令的文档:

For posix systems, the default aliases are 'cat', 'cp', 'mv', 'rm', 'rmdir', and 'mkdir', and other platform-specific aliases are added. 对于posix系统,默认别名为'cat','cp','mv','rm','rmdir'和'mkdir',并添加了其他特定于平台的别名。

For windows-based systems, the default aliases are 'copy', 'ddir', 'echo', 'ls', 'ldir', 'mkdir', 'ren', and 'rmdir'. 对于基于Windows的系统,默认别名为'copy','ddir','echo','ls','ldir','mkdir','ren'和'rmdir'。

That is why the Linux ls will work, but the cat command does not work for IPython on Windows. 这就是Linux ls可以运行,但是cat命令不适用于Windows上的IPython的原因。

Note: IPython is not a comandline tool. 注意:IPython不是强制工具。 For a Linux comandline tool on Windows try Cygwin . 对于Windows上的Linux comandline工具,请尝试Cygwin

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM