python - 运行 Dockerfile 时,python:无法打开文件 'setup.py':[Errno 2] 没有这样的文件或目录
问题描述
我正在尝试使用 Dockerfile 构建图像:sudo docker build 。-f Dockerfile
我正在使用的 Dockerfile:
FROM python:3.6.8-alpine
WORKDIR /usr/app
COPY . ./
RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN pip install -r requirements.txt
RUN export GOOGLE_APPLICATION_CREDENTIALS="/app/static/*******.json"
EXPOSE 5000
ENTRYPOINT [ "python" ]
CMD [ "app.py" ]
要求.txt
Flask-RESTful==0.3.8
Flask==1.1.2
google-cloud-documentai==0.3.0
面临的问题如下:
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v7prcez8/grpcio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v7prcez8/grpcio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-x0mxi6mn
cwd: /tmp/pip-install-v7prcez8/grpcio/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-v7prcez8/grpcio/setup.py", line 212, in <module>
if check_linker_need_libatomic():
File "/tmp/pip-install-v7prcez8/grpcio/setup.py", line 172, in check_linker_need_libatomic
stderr=PIPE)
File "/usr/local/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'cc': 'cc'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code:
除此之外:python setup.py egg_info 给我下面的日志
python: can't open file 'setup.py': [Errno 2] No such file or directory
任何修复或线索都会对我有所帮助。
解决方案
推荐阅读
- tensorflow - SegNet:为什么训练准确率高而验证准确率低?
- javascript - SlicePipe 角函数
- node.js - hyperledger fabric sdk node orderer, node client在deadline前连接失败
- java - 无法解析到JSP编译中的类型手动部署在tomcat中
- reactjs - AWS Amplify react Connect 组件中的多个订阅
- java - 从Java中的文本文件中读取记录
- redux - `fields` 在 `ReduxForm(
)`,但其值为`undefined` - python - 为什么下面的代码表现得如此奇怪?Python3.5 与 Python3.6
- rust - 为什么 `use std::{ self, ... };` 不编译?
- python - Python 可以制作类似于 Windows 的操作系统吗?