Jupyter教程

IPython命令行选项

IPython命令行选项详细操作教程
在本章中,让我们了解如何在IPython中使用各种命令行选项。

调用IPython程序

您可以使用以下选项来调用IPython程序-
# Filename : example.py
# Copyright : 2020 By Lidihuo
# Author by : www.lidihuo.com
# Date : 2020-08-28
C:\python36> ipython [subcommand] [options] [-c cmd | -m mod | file] [--] [arg]
file选项是扩展名为.py的Python脚本。如果没有其他选项,则脚本将被执行并重新出现命令提示符。
# Filename : example.py
# Copyright : 2020 By Lidihuo
# Author by : www.lidihuo.com
# Date : 2020-08-28
C:\python36>ipython hello.py
Hello IPython
welcome to interactive computing

子命令和参数

IPython命令接受以下子命令选项-
配置文件-创建和管理IPython配置文件。 内核-在没有附加前端的情况下启动内核。 查找-打印IPython目录的路径。 历史记录-管理IPython历史记录数据库。
IPython配置文件子命令接受以下参数-
ipython配置文件创建myprofile -创建新的配置文件。 ipython配置文件列表-列出所有可用的配置文件。 ipython定位配置文件myprofile -找到所需的配置文件。
要安装新的IPython内核,请使用以下命令-
# Filename : example.py
# Copyright : 2020 By Lidihuo
# Author by : www.lidihuo.com
# Date : 2020-08-28
Ipython kernel –install –name
要打印到IPython目录的路径,请使用以下命令-
# Filename : example.py
# Copyright : 2020 By Lidihuo
# Author by : www.lidihuo.com
# Date : 2020-08-28
C:\python36>ipython locate myprofile
C:\Users\acer\.ipython
此外,我们知道-
history 子命令管理IPython历史数据库。 trim 选项将IPython历史记录数据库减少到最后1000个条目。 清除选项将删除所有条目。
下面列出了IPython的其他一些重要命令行选项-
产品编号 IPython命令和说明
1
-automagic
打开魔术命令的自动调用。
2
-pdb
在每个异常后启用自动调用pdb调试器。
3
-pylab
预加载matplotlib和numpy与默认的matplotlib后端进行交互使用。
4
-matplotlib
配置matplotlib与默认的matplotlib后端进行交互使用。
5
-gui = options
启用GUI事件循环与('glut','gtk','gtk2','gtk3', 'osx','pyglet','qt','qt4','qt5','tk','wx','gtk2','qt4')。
一些IPython命令行选项的用法示例如下表所示:
产品编号 IPython命令和说明
1
ipython --matplotlib
启用matplotlib集成
2
ipython --matplotlib = qt
启用与qt4后端的matplotlib集成
3
ipython --profile = myprofile
以配置文件foo开头
4
ipython配置文件创建myprofile
使用默认配置文件创建配置文件foo
5
ipython帮助配置文件
显示配置文件subcmd的帮助
6
ipython定位
打印IPython目录的路径
7
ipython找到配置文件myprofile
打印配置文件" myprofile"的目录路径
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4