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

      <legend id='lYHT5'><style id='lYHT5'><dir id='lYHT5'><q id='lYHT5'></q></dir></style></legend>
      <i id='lYHT5'><tr id='lYHT5'><dt id='lYHT5'><q id='lYHT5'><span id='lYHT5'><b id='lYHT5'><form id='lYHT5'><ins id='lYHT5'></ins><ul id='lYHT5'></ul><sub id='lYHT5'></sub></form><legend id='lYHT5'></legend><bdo id='lYHT5'><pre id='lYHT5'><center id='lYHT5'></center></pre></bdo></b><th id='lYHT5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='lYHT5'><tfoot id='lYHT5'></tfoot><dl id='lYHT5'><fieldset id='lYHT5'></fieldset></dl></div>
      1. <small id='lYHT5'></small><noframes id='lYHT5'>

      2. <tfoot id='lYHT5'></tfoot>

          <bdo id='lYHT5'></bdo><ul id='lYHT5'></ul>

        Python 多處理不斷產(chǎn)生 pythonw.exe 進(jìn)程而不做任何實(shí)

        Python multiprocessing continuously spawns pythonw.exe processes without doing any actual work(Python 多處理不斷產(chǎn)生 pythonw.exe 進(jìn)程而不做任何實(shí)際工作)
      3. <legend id='eUUmL'><style id='eUUmL'><dir id='eUUmL'><q id='eUUmL'></q></dir></style></legend>
        <i id='eUUmL'><tr id='eUUmL'><dt id='eUUmL'><q id='eUUmL'><span id='eUUmL'><b id='eUUmL'><form id='eUUmL'><ins id='eUUmL'></ins><ul id='eUUmL'></ul><sub id='eUUmL'></sub></form><legend id='eUUmL'></legend><bdo id='eUUmL'><pre id='eUUmL'><center id='eUUmL'></center></pre></bdo></b><th id='eUUmL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eUUmL'><tfoot id='eUUmL'></tfoot><dl id='eUUmL'><fieldset id='eUUmL'></fieldset></dl></div>
        <tfoot id='eUUmL'></tfoot>

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

              <bdo id='eUUmL'></bdo><ul id='eUUmL'></ul>
                <tbody id='eUUmL'></tbody>

                • 本文介紹了Python 多處理不斷產(chǎn)生 pythonw.exe 進(jìn)程而不做任何實(shí)際工作的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我不明白為什么這么簡(jiǎn)單的代碼

                  I don't understand why this simple code

                  # file: mp.py
                  from multiprocessing import Process
                  import sys
                  
                  def func(x):
                      print 'works ', x + 2
                      sys.stdout.flush()
                  
                  p = Process(target= func, args= (2, ))
                  p.start()
                  p.join()
                  p.terminate()
                  print 'done'
                  sys.stdout.flush()
                  

                  連續(xù)創(chuàng)建pythonw.exe"進(jìn)程并且它不打印任何東西,即使我從命令行運(yùn)行它:

                  creates "pythonw.exe" processes continuously and it doesn't print anything, even though I run it from the command line:

                  python mp.py
                  

                  我在 32 位和 64 位的 Windows 7 上運(yùn)行最新的 Python 2.6

                  I am running the latest of Python 2.6 on Windows 7 both 32 and 64 bits

                  推薦答案

                  你需要保護(hù)然后使用 if __name__ == '__main__': 進(jìn)入程序的入口點(diǎn).

                  You need to protect then entry point of the program by using if __name__ == '__main__':.

                  這是一個(gè)特定于 Windows 的問(wèn)題.在 Windows 上,您的模塊必須導(dǎo)入新的 Python 解釋器才能訪問(wèn)您的目標(biāo)代碼.如果你不停止這個(gè)新的解釋器運(yùn)行啟動(dòng)代碼,它將產(chǎn)生另一個(gè)孩子,然后再產(chǎn)生另一個(gè)孩子,直到它的 pythonw.exe 進(jìn)程一目了然.

                  This is a Windows specific problem. On Windows your module has to be imported into a new Python interpreter in order for it to access your target code. If you don't stop this new interpreter running the start up code it will spawn another child, which will then spawn another child, until it's pythonw.exe processes as far as the eye can see.

                  其他平臺(tái)使用os.fork() 啟動(dòng)子進(jìn)程,所以不存在重新導(dǎo)入模塊的問(wèn)題.

                  Other platforms use os.fork() to launch the subprocesses so don't have the problem of reimporting the module.

                  所以您的代碼需要如下所示:

                  So your code will need to look like this:

                  from multiprocessing import Process
                  import sys
                  
                  def func(x):
                      print 'works ', x + 2
                      sys.stdout.flush()
                  
                  if __name__ == '__main__':
                      p = Process(target= func, args= (2, ))
                      p.start()
                      p.join()
                      p.terminate()
                      print 'done'
                      sys.stdout.flush()
                  

                  這篇關(guān)于Python 多處理不斷產(chǎn)生 pythonw.exe 進(jìn)程而不做任何實(shí)際工作的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

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

                    <i id='dUmrt'><tr id='dUmrt'><dt id='dUmrt'><q id='dUmrt'><span id='dUmrt'><b id='dUmrt'><form id='dUmrt'><ins id='dUmrt'></ins><ul id='dUmrt'></ul><sub id='dUmrt'></sub></form><legend id='dUmrt'></legend><bdo id='dUmrt'><pre id='dUmrt'><center id='dUmrt'></center></pre></bdo></b><th id='dUmrt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dUmrt'><tfoot id='dUmrt'></tfoot><dl id='dUmrt'><fieldset id='dUmrt'></fieldset></dl></div>
                        • <bdo id='dUmrt'></bdo><ul id='dUmrt'></ul>
                            主站蜘蛛池模板: 亚洲综合免费 | 欧美精品一区二区三区四区 | 国产在线h | 国产高清一区二区三区 | 一区二区精品 | 日韩高清黄色 | 91在线一区二区三区 | 91色综合| 国产午夜精品久久久 | 日本视频中文字幕 | 午夜影院网站 | 成人免费日韩 | 国产一区二区三区四区五区加勒比 | 波多野结衣av中文字幕 | 麻豆精品一区二区三区在线观看 | 亚洲精品久久久蜜桃网站 | 日韩中文字幕免费在线 | 久久一区二区三区四区 | 日韩美av| 99热99| 久久久天天 | 精品伊人 | 国产精品不卡视频 | 成人a视频 | 亚洲国产乱码 | 午夜一区 | 男人的天堂久久 | 色综合天天网 | 国产日屁 | 激情黄色在线观看 | av网站推荐| 日韩中文字幕 | 欧美一区二区三区久久精品视 | 麻豆久久久9性大片 | 国产一级免费视频 | 在线欧美亚洲 | 亚洲一区二区在线播放 | 天天草天天射 | 不卡的av在线 | 国产欧美日韩综合精品一 | 日本在线综合 |