import cPickle as pkl Traceback (most recent call last): File "preprocess_wiki.py", line 13, in import cPickle as pkl ModuleNotFoundError: No module named 'cPickle'
Asked
Active
Viewed 1.5k times
-1
-
Very broad. Is the module installed to your system? – Frontear Jun 12 '19 at 13:05
-
1`cPickle` is a Python 2.x thing, it doesn't exist in Python 3.x anymore. The corresponding C implementation is now an implementation detail of the `pickle` package which is in the standard library; it will automatically use (the equivalent of) `cPickle`, so there's no need to refer to it explicitly. – Daniel Pryden Jun 12 '19 at 13:07
1 Answers
9
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.
So Just use import pickle
for python 3

Osama Lone
- 109
- 4