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

多處理程序在 Anaconda 筆記本中有 AttributeError

Multiprocessing program has AttributeError in Anaconda notebook(多處理程序在 Anaconda 筆記本中有 AttributeError)
本文介紹了多處理程序在 Anaconda 筆記本中有 AttributeError的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在 Windows 7 64 位上運行一個簡單的Hello World"程序,其規格如下:

I am running a simple "Hello World" program on Windows 7 64 bit with the following specifications:

Python 3.4.3 | Anaconda 2.3.0 (64-bit) | [MSC v.1600 64 bit (AMD64)] IPython 4.0.0

程序:

from multiprocessing import Process, freeze_support

def f():
    print ('hello world!')

if __name__ == '__main__':
    #freeze_support()
    Process(target=f).start()

給出以下錯誤:

[I 15:02:23.855 NotebookApp] Saving file at /uhc/FeatureContributionToK-meansClu
sterWithPC.ipynb
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:Anaconda3libmultiprocessingspawn.py", line 106, in spawn_main
    exitcode = _main(fd)
  File "C:Anaconda3libmultiprocessingspawn.py", line 116, in _main
    self = pickle.load(from_parent)
AttributeError: Can't get attribute 'f' on module '__main__' (built-in)  

推薦答案

這是因為多處理在交互式解釋器中不能很好地工作.主要原因是windows中沒有適用的fork()函數.他們的網頁上對此進行了解釋.

This is because of the fact that multiprocessing does not work well in the interactive interpreter. The main reason is that there is no fork() function applicable in windows. It is explained on their web page itself.

此包中的功能要求 ma??in 模塊必須可由子模塊導入.這在編程指南中有所介紹,但在此值得指出.這意味著一些示例,例如multiprocessing.Pool 示例在交互式解釋器中不起作用."

"Functionality within this package requires that the main module must be importable by the children. This is covered in Programming guidelines however it is worth pointing out here. This means that some examples, such as the multiprocessing.Pool examples will not work in the interactive interpreter."

https://docs.python.org/2/library/multiprocessing.html#windows

如果您在多處理中使用池函數,也會出現同樣的問題.在這篇文章中解決了.因此,您可以使用該方法來執行您的并行處理想法.

This same problem will come if you are using pool function in multiprocessing. It is solved in this post . You can hence use that method for executing your idea of parallel processing.

Python 多處理 apply_async 永不返回Windows 7 上的結果

希望對你有用.

這篇關于多處理程序在 Anaconda 筆記本中有 AttributeError的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 日韩成人免费视频 | 成人国产精品视频 | 精品久久久久久久久久久久久久 | 伊人久久一区二区 | 亚洲看片 | 999国产精品视频 | 久久性色| 久久这里只有精品首页 | 欧美亚洲综合久久 | 久久99精品久久久久久琪琪 | 一区二区三区播放 | 午夜伦理影院 | 国产精品国产a级 | 区一区二在线观看 | 成人毛片视频免费 | 黄网站免费在线看 | 免费欧美视频 | 国产午夜精品视频 | 欧美综合网 | 噜噜噜噜狠狠狠7777视频 | 久久久国产一区二区三区 | 国产成人免费在线 | 久久亚洲一区二区三区四区 | 免费在线观看一区二区三区 | 91精品国产91久久久久久三级 | 日韩精品人成在线播放 | 日本特黄a级高清免费大片 国产精品久久性 | 欧美日批 | 久久一区二区视频 | 成人在线免费电影 | 精品91视频 | 日本不卡一区二区三区 | 亚洲国产精品一区二区www | 99精品在线观看 | 午夜精品一区二区三区在线 | 免费在线观看av片 | 国产精品jizz在线观看老狼 | 国产精品久久久久久久久婷婷 | 国产1区2区3区 | 亚洲精品视频免费 | www亚洲精品|