用python 3.5安装cPickle [英] installing cPickle with python 3.5

查看:1026
本文介绍了用python 3.5安装cPickle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能很愚蠢,但我无法使用python 3.5 docker image安装cPickle

This might be silly but I am unable to install cPickle with python 3.5 docker image

Dockerfile

FROM python:3.5-onbuild

requirements.txt

cpickle

当我尝试制作图像时

$ docker build -t sample .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM python:3.5-onbuild
# Executing 3 build triggers...
Step 1 : COPY requirements.txt /usr/src/app/
Step 1 : RUN pip install --no-cache-dir -r requirements.txt
 ---> Running in 016c35a032ee
Collecting cpickle (from -r requirements.txt (line 1))
  Could not find a version that satisfies the requirement cpickle (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for cpickle (from -r requirements.txt (line 1))
You are using pip version 7.1.2, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 1

推荐答案

cPickle随附于python 2.x中的标准库.您使用的是python 3.x,因此如果您要cPickle,则可以执行以下操作:

cPickle comes with the standard library… in python 2.x. You are on python 3.x, so if you want cPickle, you can do this:

>>> import _pickle as cPickle

但是,在3.x中,仅使用pickle会更容易.

However, in 3.x, it's easier just to use pickle.

无需安装任何东西.如果某些内容在python 3.x中需要cPickle,则可能是一个错误.

No need to install anything. If something requires cPickle in python 3.x, then that's probably a bug.

这篇关于用python 3.5安装cPickle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆