日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python 线程中出现执行错乱_多处理会导致Python崩溃,并在调用fork()时在另一个线程中出现错误...

發(fā)布時(shí)間:2025/3/13 python 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 线程中出现执行错乱_多处理会导致Python崩溃,并在调用fork()时在另一个线程中出现错误... 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我對(duì)Python還比較陌生,并嘗試為for循環(huán)實(shí)現(xiàn)一個(gè)多處理模塊。

我有一個(gè)圖像url數(shù)組存儲(chǔ)在img_url中,我需要下載并應(yīng)用一些Google vision。if __name__ == '__main__':

img_urls = [ALL_MY_Image_URLS]

runAll(img_urls)

print("--- %s seconds ---" % (time.time() - start_time))

這是我的runAll()方法def runAll(img_urls):

num_cores = multiprocessing.cpu_count()

print("Image URLS {}",len(img_urls))

if len(img_urls) > 2:

numberOfImages = 0

else:

numberOfImages = 1

start_timeProcess = time.time()

pool = multiprocessing.Pool()

pool.map(annotate,img_urls)

end_timeProcess = time.time()

print('\n Time to complete ', end_timeProcess-start_timeProcess)

print(full_matching_pages)

def annotate(img_path):

file = requests.get(img_path).content

print("file is",file)

"""Returns web annotations given the path to an image."""

print('Process Working under ',os.getpid())

image = types.Image(content=file)

web_detection = vision_client.web_detection(image=image).web_detection

report(web_detection)

當(dāng)我運(yùn)行它并且python崩潰時(shí),我得到這個(gè)警告objc[67570]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.

objc[67570]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

objc[67567]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.

objc[67567]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

objc[67568]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.

objc[67568]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

objc[67569]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.

objc[67569]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

objc[67571]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.

objc[67571]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

objc[67572]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.

objc[67572]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

總結(jié)

以上是生活随笔為你收集整理的python 线程中出现执行错乱_多处理会导致Python崩溃,并在调用fork()时在另一个线程中出现错误...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。