使用 python 3.5 安装 cPickle
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37132899/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
installing cPickle with python 3.5
提问by kampta
This might be silly but I am unable to install cPickle
with python 3.5 docker image
这可能很愚蠢,但我无法cPickle
使用 python 3.5 docker 映像进行安装
Dockerfile
文件
FROM python:3.5-onbuild
requirements.txt
要求.txt
cpickle
When I try to build the image
当我尝试构建图像时
$ 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
回答by Mike McKerns
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:
cPickle
带有标准库......在python 2.x中。你在 python 3.x 上,所以如果你想要cPickle
,你可以这样做:
>>> import _pickle as cPickle
However, in 3.x, it's easier just to use pickle
.
但是,在 3.x 中,使用pickle
.
No need to install anything. If something requires cPickle
in python 3.x, then that's probably a bug.
无需安装任何东西。如果cPickle
在 python 3.x 中需要某些东西,那么这可能是一个错误。