Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用matplotlib时,Emacs中的Python shell冻结_Python_Emacs_Matplotlib - Fatal编程技术网

使用matplotlib时,Emacs中的Python shell冻结

使用matplotlib时,Emacs中的Python shell冻结,python,emacs,matplotlib,Python,Emacs,Matplotlib,我以前认为这是IPython的问题,但今天我再次测试,以下是我所做的: 在cmd窗口中运行emacs-Q 打开一个.py文件 M-x,然后运行pythonshell开关切换到shell、RET和RET。然后我准备好了Python shell 我输入了以下代码: 什么也没发生……除了matplotlib,我还没有测试过其他绘图工具。我不知道这是不是一只虫子。我已经搜索了一段时间,在这里,虽然谷歌,但没有运气。我的系统是:适用于Windows的Emacs 24.3 32位,在Windows 7下。如

我以前认为这是IPython的问题,但今天我再次测试,以下是我所做的:

  • 在cmd窗口中运行
    emacs-Q
  • 打开一个.py文件
  • M-x
    ,然后运行
    pythonshell开关切换到shell
    RET
    RET
    。然后我准备好了Python shell
  • 我输入了以下代码:
  • 什么也没发生……除了matplotlib,我还没有测试过其他绘图工具。我不知道这是不是一只虫子。我已经搜索了一段时间,在这里,虽然谷歌,但没有运气。我的系统是:适用于Windows的Emacs 24.3 32位,在Windows 7下。如果其他人可以复制相同的问题,这里,我将报告这作为一个错误

    我使用IPython作为Python shell,方法是:

    C:/Python27/python.exe -i C:/Python27/Scripts/ipython-script.py --pylab
    
    然后,我输入
    figure();绘图([1,2,3])
    ,如预期,图形弹出并冻结。然后我做了:
    C-C-d
    ,它运行
    comint-send-eof
    ,这个数字实际上得到了更新!但我的IPython shell会话也会终止,并显示以下消息:

    In [6]:
    Do you really want to exit ([y]/n)?
    Traceback (most recent call last):
    File "C:/Python27/Scripts/ipython-script.py", line 9, in <module>
    load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
    SystemExit
    
    If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
    or send an email to the mailing list at ipython-dev@scipy.org
    
    You can print a more detailed traceback right now with "%tb", or use "%debug"
    to interactively debug it.
    
    Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True
    
    [6]中的
    
    是否确实要退出([y]/n)?
    回溯(最近一次呼叫最后一次):
    文件“C:/Python27/Scripts/ipython script.py”,第9行,在
    加载入口点('ipython==0.13.1','console\u scripts','ipython')()
    系统出口
    如果您怀疑这是IPython错误,请在以下地址报告:
    https://github.com/ipython/ipython/issues
    或者向ipython的邮件列表发送电子邮件-dev@scipy.org
    您可以立即使用“%tb”打印更详细的回溯,或使用“%debug”
    以交互方式调试它。
    可通过以下方式启用用于错误报告目的的额外详细回溯:
    %config Application.verbose\u crash=True
    

    有什么有用的线索吗

    我想需要一段时间才能解决问题。直到某个Windows用户实际调试python.el

    在那之前,为什么不试试呢?对于Emacs来说,它是一个更好的IPython绑定。你不需要使用笔记本的部分。您可以将其视为python.el中pythonshell的替代品。(免责声明:我是作者)

    一种解决方案是:

    (setq python-shell-interpreter "C:\\YourPython3Dist\\python.exe"
          python-shell-interpreter-args "-i C:\\YourPython3Dist\\Scripts\\ipython3-script.py console --pylab=qt")
    
    调用ipython-script.py中的参数
    console
    是重要的参数


    在使用qt后端的Python3中,它适合我。我不知道它是如何与py 2.7配合使用的。(如果
    ipytho script.py
    支持这些参数,应该没有问题)

    我在Fedora18的GNU Emacs 24.2.1上试用了它,效果很好,抱歉。但是我的系统上的钩子是
    python切换到python
    。gui主循环有问题。您使用的是什么后端?尝试将其配置为使用
    ipython--pylab
    而不是
    python
    @tcaswell我实际上使用matplotlib.use()尝试了不同的后端,但不起作用。但在cmd窗口中,它可以工作。我也试过ipython,有一个图形窗口显示出来,但它没有情节冻结。我相信这篇文章描述了同样的问题,几乎一年过去了,仍然没有对这个问题的真正答案。。。我相信它是可以复制的,如果你不介意用同样的配置来尝试的话。我没有一个windows的盒子来做任何真正的工作。启动解释器时,是否向python传递正确的线程参数<在导入
    plt
    之前,需要运行code>matplobliblib.use()。我怀疑您的系统配置不太正确。下面是我在emacs中运行Python shell的命令:
    C:/Python27/Python.exe-ic:/Python27/Scripts/ipython-script.py--pylab
    ,我的ipython是0.13.2,我的Python是2.7.5,默认后端是:TkAgg,正如我所说,它在cmd窗口下工作,所以我相信这不是问题的根源。我也试过QT。我的经验是ipython对windows不是很好,笔记本经常有内核崩溃,我在不同的机器上试过,但同样的事情发生了。我相信这是因为ipython笔记本本身需要设置一个http服务器,而该服务器在Windows下的兼容性并不完美。无论如何,感谢您制作EIN,它是Emacs的一个很棒的包,我实际上正在使用它。如果它是内核,那么问题可能是zmq,而不是http(tornado)。你发错误报告了吗?我认为ipythondev可以更快地解决Windows的问题。很高兴你喜欢EIN:)如果你有时间,你能帮我看一下问题更新吗?我想知道这是否有助于解决问题,谢谢!我不太了解python.el internal,所以我不知道如何修复它。我想你可以给emacs-devel发一份bug报告。你是让我的生活更轻松的人!它也适用于Python2.7!是的,当他们引入console参数时,它就开始工作了。在的1.0版之前,我就有这个问题Ipython@siegfried我使用的是WinPython发行版,而
    ipython3脚本。py
    不在发行版中。你知道这个设置应该是什么样子吗?我也有同样的上吊行为。
    In [6]:
    Do you really want to exit ([y]/n)?
    Traceback (most recent call last):
    File "C:/Python27/Scripts/ipython-script.py", line 9, in <module>
    load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
    SystemExit
    
    If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
    or send an email to the mailing list at ipython-dev@scipy.org
    
    You can print a more detailed traceback right now with "%tb", or use "%debug"
    to interactively debug it.
    
    Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True
    
    (setq python-shell-interpreter "C:\\YourPython3Dist\\python.exe"
          python-shell-interpreter-args "-i C:\\YourPython3Dist\\Scripts\\ipython3-script.py console --pylab=qt")