繁体   English   中英

错误:由于 OSError 无法安装软件包:[Errno 39] 目录不为空

[英]ERROR: Could not install packages due to an OSError: [Errno 39] Directory not empty

文件:

FROM python:3.10-slim

ENV PYTHONUNBUFFERED 1

WORKDIR /app
COPY ./requirements.txt .

RUN pip install --trusted-host mirrors.aliyun.com --no-cache-dir --upgrade -r requirements.txt

构建时出错:

  Attempting uninstall: setuptools
    Found existing installation: setuptools 65.5.0
    Uninstalling setuptools-65.5.0:
ERROR: Could not install packages due to an OSError: [Errno 39] Directory not empty: '/usr/local/lib/python3.10/site-packages/_distutils_hack/'

删除文件夹时似乎出现权限错误。 由于 root 是 Docker 中的默认用户,我不明白为什么缺少权限。

在不知道你的requirements.txt文件的内容的情况下,无法肯定地说,但我的猜测是你包含setuptools ,它已经在 python 标准库中。 删除此行,它应该可以工作

如果不是这种情况,请添加您的requirements.txt文件内容,以便可以重现错误(带有空文件的docker build不会抛出错误)


OSError有许多根本原因,但错误编号为 39 状态

 39: 'Destination address required',

通过发现

import os
import errno
from pprint import pprint

pprint( {i:os.strerror(i) for i in sorted(errno.errorcode)})

一些相关的帖子:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM