【问题标题】:How to configure ipy_user_conf.py to get IPython to to start with the right IDLE set as editor?如何配置 ipy_user_conf.py 以使 IPython 以正确的 IDLE 设置为编辑器开始?
【发布时间】:2010-09-28 04:32:16
【问题描述】:

64 位 Vista 蟒蛇2.6 IPython 0.10 还有 Python 2.7 和 3.1

我的 ipy_user_conf.py 有显示如何设置编辑器的示例行。我试过了

ipy_editors.idle()

但是

[C:Python26/脚本] |4>ed xxx.py 正在编辑... > C:\Python26\lib\idlelib/idle.py "xxx.py"

为 Python 3.1 打开 IDLE,但不打开 xxx.py。

我接下来在ipy_user_conf.py中模仿了一个示例行,

ipy_editors.scite('c:/opt/scite/scite.exe')

作为

ipy_editors.idle("c:/Python26/Lib/idlelib/idle.pyw")

但是

[C:Python26/脚本] |4>ed xxx.py 正在编辑... > c:/Python26/Lib/idlelib/idle.pyw "xxx.py"

在 IDLE for Python 3.1 中打开文件 c:/Python26/Lib/idlelib/idle.pyw

我的想法已经用完了。建议,请。

顺便说一句,运行 xxx.py 工作正常。

【问题讨论】:

    标签: python ipython vista64


    【解决方案1】:

    最可能的原因是 Windows 的文件扩展名关联。我猜 Python 3.1 是您安装的最后一个 Python 版本,因此默认情况下,.py 和 .pyw 现在与 3.1 可执行文件相关联。 (验证哪个 python 版本与 .py/.pyw 扩展关联的一种方法是运行assoc .py。还有其他方法。)

    要解决这个问题,请明确说明您要运行哪个 python 版本:

    ipy_editors.idle('c:/Python26/pythonw.exe c:/Python26/Lib/idlelib/idle.pyw')
    

    编辑:
    测试关联的 Pythonic 方法是创建一个 test.py 文件,例如:

    import sys
    print sys.version
    

    然后在命令提示符下,以test.py 运行它。

    【讨论】:

    • 谢谢!谢谢!这样做!在过去的 20 个小时里,我一直在试图得到答案——首先是从 ipython-user@scipy.org 列表,然后是从utor@python.org,一直在阅读文档并进行大量试验和错误。顺便说一句,我在哪里做 assoc .py ?
    • 这是一个内置的 Windows 工具。只需从命令提示符运行它。 Reference
    • 啊,我明白了。适用于 .txt: C:\Windows\System32>assoc .txt .txt=txtfile,但不适用于 .py 。当我获得整个关联列表时,.py 不在其中。嗯..
    • 好的。制作文件并运行它。 c:\>test_version.py '3.1.2 (r312:79147, Mar 22 2010, 12:30:45) [MSC v.1500 64 bit (AMD64)]' 再次感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-20
    • 1970-01-01
    • 1970-01-01
    • 2019-05-03
    相关资源
    最近更新 更多