博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Using Notepad++ as IPython default code editor
阅读量:7072 次
发布时间:2019-06-28

本文共 1841 字,大约阅读时间需要 6 分钟。

IPython supplies you the convenience of editing code from command prompt, the magic command %edit. However in Windows it will use notepad as default editor which is not suitable for editing python source code. Here is the method to config the editor option.

As IPython said:

Editor configuration

IPython can integrate with text editors in a number of different ways:

  • Editors (such as ,  and ) can send code to IPython for execution.
  • IPython’s %edit magic command can open an editor of choice to edit a code block.

The %edit command (and its alias %ed) will invoke the editor set in your environment as EDITOR. If this variable is not set, it will default to vi under Linux/Unix and to notepad under Windows. You may want to set this variable properly and to a lightweight editor which doesn’t take too long to start (that is, something other than a new instance of Emacs). This way you can edit multi-line code quickly and with the power of a real editor right inside IPython.

You can also control the editor by setting TerminalInteractiveShell.editor in ipython_config.py.

What we should do is just set the TerminalInteractiveShell.editor variable in ipython_config.py. So where is the ipython_config.py?

 The  gives a method to locating the file, using the command "ipython locate" in command line.

In my computer, the result is as follows. B.T.W, my os is Win7. 

>> ipython locate

C:\Users\xxx\.ipython

So, just find the ipython_config.py file there, if not exist just create one.

Then write the following code in the file:

c = get_config()# use DOS style pathc.TerminalInteractiveShell.editor = "C:/PROGRA~1/Notepad++/notepad++.exe"# set editor for Qt Console, if you wish to use thatc.IPythonWidget.editor = "C:/PROGRA~1/Notepad++/notepad++.exe"

Enjoy IPython with Notepad++.

转载于:https://www.cnblogs.com/nn0p/archive/2013/04/02/2995266.html

你可能感兴趣的文章
忘记Mysql的root密码怎么办?
查看>>
ODBC CRecordSet访问
查看>>
Codeforces Gym 100015C City Driving 离线LCA
查看>>
JavaScript基础:数据类型的中的那些少见多怪
查看>>
C#入门经典Lambda
查看>>
佛山Uber优步司机奖励政策(1月25日~1月31日)
查看>>
随机IP代理
查看>>
怎么提高ArcGIS for Desktop10.x的性能
查看>>
python文件相关操作
查看>>
socket.io+angular.js+express.js做个聊天应用(四)
查看>>
PLSQL Developer过期要注冊表
查看>>
JavaScript中call,apply,bind方法的总结。
查看>>
Ajax、Comet与Websocket
查看>>
Python输出中文乱码问题
查看>>
HDU 5655 CA Loves Stick 水题
查看>>
EventBus (四) Sticky事件
查看>>
linux Shell编程
查看>>
HTML元素坐标定位,这些知识点得掌握
查看>>
【服务器环境搭建-Centos】jdk的安装
查看>>
mysql主从复制的配置总结
查看>>