名称'get_config'未定义 [英] name 'get_config' is not defined

查看:191
本文介绍了名称'get_config'未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用ipython笔记本时,我想运行一个笔记本服务器。我按照官方教程但是,当我想获得 get_config()函数如教程中所述,我遇到名称 get_config 未定义问题。
我搜索了互联网,找到了页面。但是,我的ubuntu 12.04系统中没有〜/ .ipython / profile_default / ipython_config.py 文件。我该怎么做才能解决问题?

when i am working with ipython notebook, i want to run a notebook server. I followed the official tutorial However, when I want to obtain the get_config() function as said in the tutorial, I come across with the name get_config is not defined problem. I searched the internet and found the page . However, there is no ~/.ipython/profile_default/ipython_config.py file in my ubuntu 12.04 system. What can I do to solve the problem?

推荐答案

Paul Ivanov在论坛帖子中说:

Paul Ivanov stated in the forum post:


get_config仅在
加载时的配置文件中可用。

get_config is available only inside the configuration files at load time.

所以你只能在配置文件中使用 get_config ,而不能在 ipython 会话中使用。

So you can only use get_config in configuration files, not in an ipython session.

您基本上有两个选择:

如果您只想进行临时更改,可以使用 %config 魔术。但请注意,退出会话后更改会丢失。

If you only want to make temporary changes, you can use the %config magic. But note that changes are lost after you exit the session.

文档说明:


目前,这仅影响当前会话 - 您对配置所做的更改不会保存在任何位置。此外,一些选项仅在IPython启动时读取,因此不能像这样更改。

At present, this only affects the current session - changes you make to config are not saved anywhere. Also, some options are only read when IPython starts, so they can’t be changed like this.

第二个选项是创建新的个人资料。 (参见 ipython profile help )。每个配置文件都有自己的配置文件。您可以通过执行以下命令找到这些文件:

The second option is to create a new profile. (see ipython profile help). Each profile comes with its own config files. You can find the files by executing:

ls $(ipython locate profile <your-profile-name>)

您可以将配置选项添加到特定的 * _ config.py file。

You can add your configuration options to a specific *_config.py file.

如需进一步阅读,请参阅ipython的 config intro

For a further reading, see ipython's config intro.

这篇关于名称'get_config'未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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