在Jupyter Notebook中执行终端命令 [英] Executing terminal commands in Jupyter notebook

查看:2337
本文介绍了在Jupyter Notebook中执行终端命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Jupyter笔记本中运行以下命令(如果有帮助,请使用Python 2):

I am trying to run the following in Jupyter notebook (with Python 2 if it makes a difference):

!head xyz.txt

,我收到以下错误消息:

and I get the following error:

'head'不被识别为内部或外部命令,可操作 程序或批处理文件.

'head' is not recognized as an internal or external command, operable program or batch file.

是否需要导入才能执行此操作?

Is there anything I need to import to be able to do this?

推荐答案

可能对其他人有用. 使用 !然后是要执行的终端命令.运行一个shell命令.例如

Might be useful for others. Use ! followed by terminal command you want to execute. To run a shell command. E.g.,

! pip install some_package

安装some_package.

to install the some_package.

这篇关于在Jupyter Notebook中执行终端命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆