python – pip install pickle not working – 没有这样的文件或目录

Ubuntu 16.04 LTS,试图用pip安装cpickle.我搜索了一下,还没找到任何有用的东西.

PYTHONPATH未设定.

错误信息

user@hostname:~$sudo -H pip3 install cpickle
Collecting cpickle
  Using cached cpickle-0.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "Failed with error code 1 in /tmp/pip-build-wn926hef/cpickle/
You are using pip version 8.1.1,however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


    ----------------------------------------
Command "python setup.py egg_info" Failed with error code 1 in /tmp/pip-build-q46tq1l8/cpickle/
You are using pip version 8.1.1,however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

故障排除步骤

# version info
user@hostname:~$python --version
Python 2.7.12
user@hostname:~$python3 --version
Python 3.5.2

# I don't think cache is the problem
rm -rf ~/.cache/
sudo -H pip install  cpickle --no-cache-dir # same problem
sudo -H pip3 install  cpickle --no-cache-dir # same problem
最佳答案
检查互联网,我发现了这个

enter image description here

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. The profile module is on the list for 3.1. The StringIO module has been turned into a class in the io module.

这意味着在Python3中它作为一个库…

import _pickle as cPickle

相关文章

文件查找(find) 1 find 简单的说,就是实时查找指定的内容或条件。特点:最新、最快、最准确。 用法:...
非交互式添加分区 方法一 添加/deb/sdb 下的分区,其实位置为1到1000M,第二个分区位置为1001至3000M,...
编译安装httpd 1 去官网下载源码包 为避免非法软件,一定要去官网下载http://www.apache.org httpd-2.4...
gdisk用法 gdisk - InteractiveGUIDpartitiontable (GPT) manipulator GPTfdisk (akagdisk) isatext-mo...
1 一定用快捷键 这里简单的说下几个常用的快捷按键。 1.1 移动光标快捷键 Crtl + a 光标回到命令行...
bash shell中测试命令 test命令提供了if-than语句中测试不同条件的途径。如果test命令中列出的条件成立...