我正在尝试从dockerfile中的require.txt安装一些python软件包。 对于其他所有程序包,都会引发以下错误: '无法找到满足require.json要求的版本 没有匹配的分布
软件包包括json,csv,re等。
我正在ubuntu 16.04上运行它,并使用'python:3.6-slim'的图像
我对此有很多疑问,但无法解决我的问题。 我也尝试过更新点子。
有人可以帮我吗?
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
答案 0 :(得分:1)
json, csv, re
等都是内置模块,请勿使用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
,它不是内置模块,它位于/usr/lib/python3/dist-packages
中:
root@orange:~# python3 -c 'import requests; print(requests.__file__)'
/usr/lib/python3/dist-packages/requests/__init__.py