Can't find module cPickle using Python 3.5 and

2019-06-14 22:52发布

I am trying to use cPickle on a windows box, using Anaconda. I am using python 3.5. I am not using a virtualenv (though probably should be).

When I try to import cPickle I get "ImportError: No module named 'cPickle'"

Python 3.5.0 |Anaconda custom (64-bit)| (default, Dec  1 2015, 11:46:22) [MSC v.
1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cPickle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'cPickle'

My understanding is that cPickle comes built in with Python 3.5, so I can't understand why cPickle is not found. Any idea what has gone wrong/how I can clean things up/how to troubleshoot the issue.

2条回答
Emotional °昔
2楼-- · 2019-06-14 23:38

There is no cPickle in Python 3. Just import pickle. pickle will automatically use the C accelerator.

查看更多
姐就是有狂的资本
3楼-- · 2019-06-14 23:48

try import pickle as cPickle. this way you don't have to edit much

查看更多
登录 后发表回答