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.
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.
In Python 2, cPickle is the accelerated version of pickle, and a later addition to the standard library. It was perfectly normal to import it with a fallback to pickle. In Python 3 the accelerated version has been integrated and there is simply no reason to use anything other than import pickle .
There is no cPickle
in Python 3. Just import pickle
. pickle
will automatically use the C accelerator.
try import pickle as cPickle
. this way you don't have to edit much
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With