如何在 Notepad++ 中执行 Python 脚本? [英] How to Execute a Python Script in Notepad++?

查看:116
本文介绍了如何在 Notepad++ 中执行 Python 脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更喜欢使用 Notepad++ 进行开发,

I prefer using Notepad++ for developing,

如何通过 Notepad++ 执行 Python 中的文件?

How do I execute the files in Python through Notepad++?

推荐答案

第一个选项:(最简单,推荐)

打开记事本++.在菜单上转到:运行 -> 运行.. (F5).输入:

First option: (Easiest, recommended)

Open Notepad++. On the menu go to: Run -> Run.. (F5). Type in:

C:\Python26\python.exe "$(FULL_CURRENT_PATH)"

现在,不要按运行,而是按保存为其创建快捷方式.

Now, instead of pressing run, press save to create a shortcut for it.

备注

  • 如果你有 Python 3.1:输入 Python31 而不是 Python26
  • 添加 -i 如果您希望在脚本完成后命令行窗口保持打开状态
  • If you have Python 3.1: type in Python31 instead of Python26
  • Add -i if you want the command line window to stay open after the script has finished

使用运行 Python 脚本的批处理脚本,然后从 Notepad++ 创建一个快捷方式.

Use a batch script that runs the Python script and then create a shortcut to that from Notepad++.

如此处所述:http://it-ride.blogspot.com/2009/08/notepad-and-python.html

代码打开HKEY_CURRENT_USER\Software\Python\PythonCore",如果key存在,会从这个key的第一个子key获取路径.

The code opens "HKEY_CURRENT_USER\Software\Python\PythonCore", if the key exists it will get the path from the first child key of this key.

检查这个key是否存在,如果不存在,你可以尝试创建它.

Check if this key exists, and if does not, you could try creating it.

这篇关于如何在 Notepad++ 中执行 Python 脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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