无法从 requirement.txt 中找到满足要求“ ”的版本。找不到包的匹配分布

Could not find a version that satisfies a requirement ' ' from requirement.txt. No matching distribution found for the package

我正在尝试在我的 dockerfile 中安装来自 requirement.txt 的一些 python 包。 对于其他所有包,它都会抛出错误 '找不到满足 requirement.json 要求的版本 没有匹配的分布'

包包括 json、csv、re 等等。

我是 运行 它在 ubuntu 16.04,使用的是 'python:3.6-slim'

的图像

我在这方面发现了很多问题,但无法解决我的问题。 我也尝试过更新我的 pip。

有人可以帮我解决这个问题吗?

dockerfile 是

FROM python:3.6-slim

WORKDIR /app

ADD . . 

RUN apt-get update && apt-get upgrade python-pip -y

RUN pip install --trusted-host pypi.python.org -r req.txt

EXPOSE 8080

CMD ["python", "server_reformulator_inference.py"]

而requirement.txt是

numpy
requests
openpyxl
xlsxwriter
absl-py
google-apputils
grpcio
grpcio-tools
keras
nltk
pandas
portpicker
pygtrie
sentencepiece
tensorflow==1.12.2
tensorflow-tensorboard
spacy
Flask
Flask-Excel
tqdm
argparse
multiprocessing
enum
six
pprint

json, csv, re 等都是 build-in 模块,你不应该使用 pip.

安装它们

看下,都在python标准库路径/usr/lib/python3.6.

root@orange:~# python3 -c 'import json; print(json.__file__)'
/usr/lib/python3.6/json/__init__.py
root@orange:~# python3 -c 'import csv; print(csv.__file__)'
/usr/lib/python3.6/csv.py
root@orange:~# python3 -c 'import re; print(re.__file__)'
/usr/lib/python3.6/re.py

作为比较,参见 requests,它不是 build-in 模块,它位于 /usr/lib/python3/dist-packages:

root@orange:~# python3 -c 'import requests; print(requests.__file__)'
/usr/lib/python3/dist-packages/requests/__init__.py