48

I tried sudo apt-get install cPickle and python3.4-cPickle but it doesn't work.

67

There is no cPickle in python 3:

A common pattern in Python 2.x is to have one version of a module implemented in pure Python, with an optional accelerated version implemented as a C extension; for example, pickle and cPickle. This places the burden of importing the accelerated version and falling back on the pure Python version on each user of these modules. In Python 3.0, the accelerated versions are considered implementation details of the pure Python versions. Users should always import the standard version, which attempts to import the accelerated version and falls back to the pure Python version. The pickle / cPickle pair received this treatment.

-Source.

| improve this answer | |
  • "the accelerated versions are considered implementation details of the pure Python versions": what does this exactly mean? – Basj Feb 4 at 12:57
  • @Basj: It means you should import pickle, not import cPickle. – Paul Price Feb 4 at 21:43
  • @basj, "Implementation detail" means something that should be hidden from us users. We just want the pickle functionality and should not care if its implemented in python or c. So, it means don't make us understand...python just do the best thing. – Robert Lugg May 6 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.