python 3.X 没有cPickle

时间: 2023-07-09 admin 互联网

python 3.X 没有cPickle

python 3.X 没有cPickle

导入时候会说 No module named cpickle
我在python安装路径下也搜索不到cpickle 倒是能搜索到pickle TypeError: must be str, not bytes

Protocol version 3 was added in Python 3.0. It has explicit support for bytes and cannot be unpickled by Python 2.x pickle modules

f = open('draft.txt','w') --------------> f = open('draft.txt','wb')

f = open('draft.txt','r') --------------> f = open('draft.txt','rb')