久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='2ftgD'></small><noframes id='2ftgD'>

  • <legend id='2ftgD'><style id='2ftgD'><dir id='2ftgD'><q id='2ftgD'></q></dir></style></legend>

      • <bdo id='2ftgD'></bdo><ul id='2ftgD'></ul>
    1. <i id='2ftgD'><tr id='2ftgD'><dt id='2ftgD'><q id='2ftgD'><span id='2ftgD'><b id='2ftgD'><form id='2ftgD'><ins id='2ftgD'></ins><ul id='2ftgD'></ul><sub id='2ftgD'></sub></form><legend id='2ftgD'></legend><bdo id='2ftgD'><pre id='2ftgD'><center id='2ftgD'></center></pre></bdo></b><th id='2ftgD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2ftgD'><tfoot id='2ftgD'></tfoot><dl id='2ftgD'><fieldset id='2ftgD'></fieldset></dl></div>

        <tfoot id='2ftgD'></tfoot>

        為什么 tkinter 不能很好地處理多處理?

        Why doesn#39;t tkinter play nicely with multiprocessing?(為什么 tkinter 不能很好地處理多處理?)

            <tbody id='NlAOr'></tbody>

          <legend id='NlAOr'><style id='NlAOr'><dir id='NlAOr'><q id='NlAOr'></q></dir></style></legend>
            <bdo id='NlAOr'></bdo><ul id='NlAOr'></ul>

            • <small id='NlAOr'></small><noframes id='NlAOr'>

                <i id='NlAOr'><tr id='NlAOr'><dt id='NlAOr'><q id='NlAOr'><span id='NlAOr'><b id='NlAOr'><form id='NlAOr'><ins id='NlAOr'></ins><ul id='NlAOr'></ul><sub id='NlAOr'></sub></form><legend id='NlAOr'></legend><bdo id='NlAOr'><pre id='NlAOr'><center id='NlAOr'></center></pre></bdo></b><th id='NlAOr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NlAOr'><tfoot id='NlAOr'></tfoot><dl id='NlAOr'><fieldset id='NlAOr'></fieldset></dl></div>
              1. <tfoot id='NlAOr'></tfoot>
                  本文介紹了為什么 tkinter 不能很好地處理多處理?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  以下代碼在linux中的python 3.2.2中沒有做任何事情就掛起:

                  The following code hangs without doing anything in python 3.2.2 in linux:

                  import tkinter
                  from multiprocessing import Process
                  
                  def f():
                      root = tkinter.Tk()
                      label = tkinter.Label(root)
                      label.pack()
                      root.mainloop()
                  
                  p = Process(target=f)
                  p.start()
                  

                  我找到的關于這個問題的唯一信息是 issue 5527,其中指出問題出在 tkinter 在進程被分叉之前被導入,可以通過在函數 f 中導入 tkinter 來修復,并且該問題在 Linux 中出現但不是索拉里斯.

                  The only information I have found about this problem is issue 5527, in which it is noted that the problem is with tkinter being imported before the process is forked, that it can be fixed by importing tkinter inside the function f, and that the problem occurs in Linux but not Solaris.

                  有誰知道究竟是什么導致了這個問題,是故意的還是最終會得到解決?除了在我需要的任何地方本地導入 tkinter 之外,還有其他解決方法嗎(這看起來很糟糕)?其他模塊是否有類似的多處理問題?

                  Does anyone know what exactly is causing this problem, and if it is intentional or will eventually be fixed? Is there any workaround other than to import tkinter locally everywhere I need it (which seems like bad style)? Do any other modules have similar issues with multiprocessing?

                  推薦答案

                  截至 2013 年 9 月,有一些關于錯誤報告的附加評論可以讓您更深入地了解實際問題.

                  As of September 2013, there are some additional comments on the bug report that give more insight into what the actual problem is.

                  http://bugs.python.org/issue5527#msg194848
                  http://bugs.python.org/issue5527#msg195480

                  基于上述情況,我猜測正在發生以下情況:Tkinter 不是線程安全的,因此(無論出于何種原因)Tkinter 想知道哪個線程是主線程.Tkinter 假設加載 Tkinter 模塊時的主線程也將是程序執行的主線程.當你在加載 Tkinter 后 fork 或 multiprocess 時,這個假設就被打破了.(例如,fork 后,記住的主線程在父線程,而不是子線程.)

                  Based on the above, I'm guessing something like the following is happening: Tkinter is not thread safe, so (for whatever reason) Tkinter wants to know which thread is the main thread. Tkinter assumes that the main thread when the Tkinter module is loaded will also be the main thread for program execution. When you fork or multiprocess after loading Tkinter, this assumption is broken. (For example, after a fork, the remembered main thread is in the parent, not the child.)

                  這篇關于為什么 tkinter 不能很好地處理多處理?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  What exactly is Python multiprocessing Module#39;s .join() Method Doing?(Python 多處理模塊的 .join() 方法到底在做什么?)
                  Passing multiple parameters to pool.map() function in Python(在 Python 中將多個參數傳遞給 pool.map() 函數)
                  multiprocessing.pool.MaybeEncodingError: #39;TypeError(quot;cannot serialize #39;_io.BufferedReader#39; objectquot;,)#39;(multiprocessing.pool.MaybeEncodingError: TypeError(cannot serialize _io.BufferedReader object,)) - IT屋-程序員軟件開
                  Python Multiprocess Pool. How to exit the script when one of the worker process determines no more work needs to be done?(Python 多進程池.當其中一個工作進程確定不再需要完成工作時,如何退出腳本?) - IT屋-程序員
                  How do you pass a Queue reference to a function managed by pool.map_async()?(如何將隊列引用傳遞給 pool.map_async() 管理的函數?)
                  yet another confusion with multiprocessing error, #39;module#39; object has no attribute #39;f#39;(與多處理錯誤的另一個混淆,“模塊對象沒有屬性“f)

                  <small id='LyjUs'></small><noframes id='LyjUs'>

                  <legend id='LyjUs'><style id='LyjUs'><dir id='LyjUs'><q id='LyjUs'></q></dir></style></legend>

                        <tbody id='LyjUs'></tbody>
                          • <bdo id='LyjUs'></bdo><ul id='LyjUs'></ul>
                            <tfoot id='LyjUs'></tfoot>

                            <i id='LyjUs'><tr id='LyjUs'><dt id='LyjUs'><q id='LyjUs'><span id='LyjUs'><b id='LyjUs'><form id='LyjUs'><ins id='LyjUs'></ins><ul id='LyjUs'></ul><sub id='LyjUs'></sub></form><legend id='LyjUs'></legend><bdo id='LyjUs'><pre id='LyjUs'><center id='LyjUs'></center></pre></bdo></b><th id='LyjUs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LyjUs'><tfoot id='LyjUs'></tfoot><dl id='LyjUs'><fieldset id='LyjUs'></fieldset></dl></div>
                            主站蜘蛛池模板: 欧美久久综合 | 激情久久久久 | 中文字幕不卡在线 | 精品久久影院 | 美日韩一区二区三区 | 国产精品久久久久久久久久久久午夜片 | www.色日本| 久热精品在线 | 日韩无遮挡 | 欧美成人小视频 | 久久久久久中文字幕 | 欧美视频一二三区 | 国产成人免费视频 | 五十路av | 天天操夜夜撸 | 涩五月婷婷 | 视频一区二区在线 | 一区二区国产在线 | 中文字幕观看 | 日韩a在线 | 国产精品日韩在线 | 免费av在线 | 日本免费网站 | 日韩午夜av | 黄免费网站 | 精品视频免费 | 欧美综合网| 香蕉视频在线看 | 涩涩的动漫 | 伊人久久久 | 国产精品自拍第一页 | 日韩三级在线播放 | 国产毛片在线 | 国产福利一区二区 | 色黄大色黄女片免费中国 | 欧美在线播放视频 | 91在线精品李宗瑞 | 小镇姑娘国语版在线观看免费 | 日日日操| 色婷婷视频在线观看 | 欧美日韩免费一区二区三区 |