欢迎来到 AI 中文社区(简称 AI 中文社),这里是学习交流 AI 人工智能技术的中文社区。 为了更好的体验,本站推荐使用 Chrome 浏览器。
全部教程·
Python语言·
Jupyter
[目录]
·
IPython 环境变量
Jupyter 教程
IPython 安装
IPython 启动
IPython 运行脚本
IPython 历史命令
IPython 系统命令
IPython 命令行选项
IPython 动态对象自省
IPython IO缓存
IPython 环境变量
IPython shell代码
IPython 嵌入
IPython 魔术命令
Jupyter 项目
Jupyter 笔记本
Jupyter 在线使用
Jupyter 安装与入门
Jupyter 仪表盘
Jupyter 用户界面
Jupyter 单元格类型
Jupyter 编辑
Jupyter Markdown
Jupyter 魔术功能
Jupyter 绘图
Jupyter 转换
Jupyter IPyWidgets
Jupyter QtConsole入门
QtConsole 多行编辑
QtConsole 嵌入式图形
QtConsole 保存为HTML
QtConsole 多个控制台
Jupyter 笔记本连接
Jupyter 笔记本共享
JupyterLab 概述
JupyterLab 安装和入门
JupyterLab 界面
JupyterLab 安装R内核
Jupyter 教程
IPython 安装
IPython 启动
IPython 运行脚本
IPython 历史命令
IPython 系统命令
IPython 命令行选项
IPython 动态对象自省
IPython IO缓存
IPython 环境变量
IPython shell代码
IPython 嵌入
IPython 魔术命令
Jupyter 项目
Jupyter 笔记本
Jupyter 在线使用
Jupyter 安装与入门
Jupyter 仪表盘
Jupyter 用户界面
Jupyter 单元格类型
Jupyter 编辑
Jupyter Markdown
Jupyter 魔术功能
Jupyter 绘图
Jupyter 转换
Jupyter IPyWidgets
Jupyter QtConsole入门
QtConsole 多行编辑
QtConsole 嵌入式图形
QtConsole 保存为HTML
QtConsole 多个控制台
Jupyter 笔记本连接
Jupyter 笔记本共享
JupyterLab 概述
JupyterLab 安装和入门
JupyterLab 界面
JupyterLab 安装R内核
IPython 环境变量
不同的环境变量会影响Python的行为。 PYTHONSTARTUP环境变量已分配给Python脚本。效果是,此脚本在Python提示符出现之前被执行。如果每次新的Python会话启动时都会默认加载某些模块,则这很有用。
以下脚本(start.py)导入IPython模块并执行start_ipython()函数,以在调用Python可执行文件时由IPython shell用提示符 (>>>)替换默认的Python shell。
# Filename : example.py # Copyright : 2020 By aizws # Author by : www.aizws.net # Date : 2020-08-28 import os, IPython os.environ['PYTHONSTARTUP'] = '' IPython.start_ipython() raise SystemExit
假设此文件存储在Python的安装目录(c:\ python36)中,请设置PYTHONSTARTUP环境变量,然后从命令行启动Python。然后IPython shell如下所示:

请注意,可以使用Windows中的"系统属性"对话框和Linux中的export命令来永久设置环境变量。
下一章:IPython shell代码
IPython 可以使用默认的 >>> 提示符和另一个 IPython 会话从标准 Python 控制台读取。以下屏幕截图显示了用标准 Python Shell 编写的 for 循环:复制代 ...
AI 中文社