我通过在计算机设备上使用 pickle.dump 保存了多个数字。现在,我想使用 pickle.load 将文件加载到我的笔记本电脑上。我写了下面的代码
对于文件名中的文件名:
with open( path + filename + '.pkl','rb' ) as file:
linedata = pickle.load(file)
# plt.close()
ax = plt.gca()
for m in range( len(M) ):
line = ax.lines[ m ]
keyname = filename + '_M=' + str( M[m] )
outdict[keyname] = [ line.get_xdata(line), line.get_ydata(line), Linestyle[cnt], Labels[cnt]+ r'$~M={}$'.format(M[m]), Colors[m] ]
plt.close()
cnt+=1
但是,会引发以下错误:
AttributeError: Can't get attribute '_picklable_subplot_class_constructor' on
如果有人能解决我的问题,我将不胜感激。
I have saved multiple figures by using pickle.dump on a computer device. Now, I want to load the files on my laptop using pickle.load. I wrote the following code
for filename in filenames:
with open( path + filename + '.pkl','rb' ) as file:
linedata = pickle.load(file)
# plt.close()
ax = plt.gca()
for m in range( len(M) ):
line = ax.lines[ m ]
keyname = filename + '_M=' + str( M[m] )
outdict[keyname] = [ line.get_xdata(line), line.get_ydata(line), Linestyle[cnt], Labels[cnt]+ r'$~M={}
However, the following error is raised:
AttributeError: Can't get attribute '_picklable_subplot_class_constructor' on <module 'matplotlib.axes._subplots' from '/Users/saleh/miniforge3/lib/python3.9/site-packages/matplotlib/axes/_subplots.py'>
I would appreciate if anyone can solve my problem.
.format(M[m]), Colors[m] ]
plt.close()
cnt+=1
However, the following error is raised:
AttributeError: Can't get attribute '_picklable_subplot_class_constructor' on <module 'matplotlib.axes._subplots' from '/Users/saleh/miniforge3/lib/python3.9/site-packages/matplotlib/axes/_subplots.py'>
I would appreciate if anyone can solve my problem.
发布评论