Can't find module cPickle using Python 3.5 and Anaconda

早过忘川 提交于 2020-01-10 03:26:06

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/49579282/cant-find-module-cpickle-using-python-3-5-and-anaconda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!