我无法使用 pip 安装 cPickle 模块:
$ pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
$ pip install cPickle
...
Could not find any downloads that satisfy the requirement pickle
Run Code Online (Sandbox Code Playgroud)
尝试使用 pip3 安装也不成功:
$ pip3 --version
pip 1.5.6 from /usr/lib/python3/dist-packages (python 3.4)
$ pip3 install cPickle
...
Could not find any downloads that satisfy the requirement cPickle
Run Code Online (Sandbox Code Playgroud)
你能帮我理解为什么这不起作用吗?
Python 2.7 和 Python 3.4 已经包含 pickle 和 cPickle 模块。您不需要采取任何额外的步骤来安装它们。您可以通过键入来查看当前安装的模块列表
help('modules')
Run Code Online (Sandbox Code Playgroud)
从 Python 提示。
cPickle 默认是标准库的一部分,但大写的 P 可能会令人困惑。你应该使用:
import cPickle
Run Code Online (Sandbox Code Playgroud)
有了资本P。
| 归档时间: |
|
| 查看次数: |
50403 次 |
| 最近记录: |