Python, how to handle the quot;ValueError: unsupported pickle protocol: 4quot; error?(Python,如何处理“ValueError:不支持的pickle协议:4;错误?)
问题描述
我是 Python 新手.我必须运行这个 TargetFinder 脚本(自定义分析").
I'm new to Python. I've to run this TargetFinder script ("Custom Analyses").
我安装了所有必需的 python 包,并将代码复制到我命名为 main.py
的脚本中,然后运行它.我收到了这个错误:
I installed all the required python packages, and copied the code into a script I named main.py
, and ran it.
I got this error:
[davide@laptop]$ python main.py
Traceback (most recent call last):
File "main.py", line 8, in <module>
training_df = pd.read_hdf('./paper/targetfinder/K562/output-epw/training.h5', 'training').set_index(['enhancer_name', 'promoter_name'])
File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 330, in read_hdf
return store.select(key, auto_close=auto_close, **kwargs)
File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 680, in select
return it.get_result()
File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 1364, in get_result
results = self.func(self.start, self.stop, where)
File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 673, in func
columns=columns, **kwargs)
File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 2786, in read
values = self.read_array('block%d_values' % i)
File "/usr/lib64/python2.7/site-packages/pandas/io/pytables.py", line 2327, in read_array
data = node[:]
File "/usr/lib64/python2.7/site-packages/tables/vlarray.py", line 677, in __getitem__
return self.read(start, stop, step)
File "/usr/lib64/python2.7/site-packages/tables/vlarray.py", line 817, in read
outlistarr = [atom.fromarray(arr) for arr in listarr]
File "/usr/lib64/python2.7/site-packages/tables/atom.py", line 1211, in fromarray
return cPickle.loads(array.tostring())
ValueError: unsupported pickle protocol: 4
我不知道这个 pickle 协议是什么意思,我的同事也对此一无所知.
I've no idea about what this pickle protocol means, and also my colleagues know nothing about it.
我该如何解决这个问题?
我在 CentOS Linux 版本 7.2.1511(核心)操作系统上使用 Python 2.7.5
I'm using Python 2.7.5 on a CentOS Linux release 7.2.1511 (Core) operating system
推荐答案
Pickle 协议基本上就是文件格式.从 文档,使用的协议越高,读取生成的 pickle 所需的 Python 版本越新. ... Pickle 协议版本 4 是在 Python 3.4 中添加的,您的 Python 版本(2.7.5) 不支持这个.
The Pickle protocol is basically the file format. From the documentation, The higher the protocol used, the more recent the version of Python needed to read the pickle produced. ... Pickle protocol version 4 was added in Python 3.4, your python version (2.7.5) does not support this.
要么升级到 Python 3.4 或更高版本(当前为 3.5),要么在 pickle.dump()
的第三个参数中使用较低的协议 (2) 创建 pickle.
Either upgrade to Python 3.4 or later (current is 3.5) or create the pickle using a lower protocol (2) in the third parameter to pickle.dump()
.
这篇关于Python,如何处理“ValueError:不支持的pickle协议:4";错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python,如何处理“ValueError:不支持的pickle协议:4";错误?


基础教程推荐
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 包装空间模型 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01