加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

python – pip install pickle not working – 没有这样的文

发布时间:2020-12-13 19:07:08 所属栏目:Linux 来源:网络整理
导读:Ubuntu 16.04 LTS,试图用pip安装cpickle.我搜索了一下,还没找到任何有用的东西. PYTHONPATH未设定. 错误信息 user@hostname:~$sudo -H pip3 install cpickleCollecting cpickle Using cached cpickle-0.5.tar.gz Complete output from command python setup.

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 "

故障排除步骤

# 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读