1. ホーム
  2. python

[解決済み] python 3.5でcPickleをインストールする。

2022-03-04 18:11:23

質問

バカみたいな話なんですが、このサイトがインストールできないんです。 cPickle python 3.5 の docker イメージを使用します。

ドッカーファイル

FROM python:3.5-onbuild

要件.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の標準ライブラリに付属しています。 cPickle ということです。

>>> import _pickle as cPickle

しかし、3.xでは、単に pickle .

何もインストールする必要はありません。 何かが必要な場合 cPickle の場合、それはおそらくバグです。