如何查找在pickle文件中使用的Spacy和python版本?

问题描述

我想打开几个月前转储的以下pickle文件,但出现以下错误

dataset_s = pickle.load(open("dataset_s.pickle",'rb'))

AttributeError: Can't get attribute 'cluster' on <module 'spacy.lang.lex_attrs' from ...

此外,当我想import使用的软件包时,会收到以下警告。

DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in 
    the future. Please pass the result to `transformed_cell` argument and any exception 
    that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 
    and above,and should_run_async(code)

有人可以帮助我解决这些问题吗?

解决方法

如果要从Github获取此文件,则很可能他们有一个名为requirements.txt的文件,其中描述了软件包的版本要求。

根据您所使用的环境,甚至可以使用不同的方法来设置环境,以根据requirements.txt自动更新/反向:

警告不会影响您当前的运行,但是最好根据您的要求更改代码以使其与软件包的将来版本兼容。或者,您也可以保存版本信息,以备将来使用。