name 'get_config' is not defined

▼魔方 西西 提交于 2019-12-09 02:36:52

问题


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?


回答1:


Paul Ivanov stated in the forum post:

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

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

You basically have two options:

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.

The documentation says:

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.

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>)

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

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



来源:https://stackoverflow.com/questions/27666134/name-get-config-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!