AttributeError: 'Image' 对象没有属性 'save'

问题描述

我正在学习 RDKit 的基本教程。

p = Chem.MolFromSmiles('[nH]1cnc2cncnc21')
subms = [x for x in ms if x.HasSubstructMatch(p)]
len(subms)

AllChem.Compute2DCoords(p)

for m in subms: AllChem.GenerateDepictionMatching2DStructure(m,p)
    img=Draw.MolsToGridImage(subms,molsPerRow=4,subImgSize=(200,200),legends=[x.GetProp("_Name") for x in subms])    
    img.save('images/cdk2_molgrid.aligned.o.png')    

我的版本是这样的:

NP=pd.read_excel(r'C:\Users\BajMic\NPPics.xlsx',header=0,index_col=False,keep_default_na=True)
NP['mol']=NP.smiles.apply(getMol)

ms= [i for i in NP['mol'] if i is not None]
img=Draw.MolsToGridImage(ms,molsPerRow=10)
img.save('Pic.png')

在这两种情况下,教程和我自己的代码,我都得到同样的错误: AttributeError: 'Image' 对象没有属性 'save'

现在,这令人困惑,因为我只是在学习一个简单的教程。我查看了其他类似的主题,但我认为我的案例要简单得多。我在这里错过了什么?

教程:https://www.rdkit.org/docs/GettingStartedInPython.html

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)