You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
code
from cmath import inf, nan
import pandas as pd
import numpy as np
import os
from joblib import Parallel, delayed
from random import sample
import sys
import glob
import re
import random
import json
import time
def plot(pallNum):
def func(i):
while(True):
print(i)
time.sleep(3)
return(i)
Parallel(n_jobs=pallNum)(delayed(func)(i) for i in range(1,10))
if name == 'main':
plot(10)
tips:
#替换成这行无报错
Parallel(n_jobs=pallNum, backend = "threading")(delayed(func)(i) for i in range(1,10))
无报错 正常运行
raise self._exception
_pickle.PicklingError: Could not pickle the task to send it to the workers.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
环境python3.8
Pyarmor 9.0.7
pyarmor g src -O dist38
code
from cmath import inf, nan
import pandas as pd
import numpy as np
import os
from joblib import Parallel, delayed
from random import sample
import sys
import glob
import re
import random
import json
import time
def plot(pallNum):
def func(i):
while(True):
print(i)
time.sleep(3)
return(i)
Parallel(n_jobs=pallNum)(delayed(func)(i) for i in range(1,10))
if name == 'main':
tips:
#替换成这行无报错
Parallel(n_jobs=pallNum, backend = "threading")(delayed(func)(i) for i in range(1,10))
无报错 正常运行
raise self._exception
_pickle.PicklingError: Could not pickle the task to send it to the workers.
在多线程环境中,可以运行,在多进程环境中不能执行,pyarmor 目前支持多进程么
Beta Was this translation helpful? Give feedback.
All reactions