简体   繁体   English

Python distutils keyError

[英]Python distutils keyError

I had a working code of disutils in setup.py file like the following我在 setup.py 文件中有一个 disutils 的工作代码,如下所示

from distutils.command.install import INSTALL_SCHEMES

for scheme in list(INSTALL_SCHEMES.values()):
    scheme['data'] = scheme['purelib']

but today I got the following error while trying to run CI in github action但是今天我尝试在 github 操作中运行 CI 时出现以下错误

Traceback (most recent call last):
  File "/home/runner/work/kombu/kombu/setup.py", line 60, in <module>
    scheme['data'] = scheme['purelib']
KeyError: 'purelib'

I have not got enough resource to figure out the solution, yes distutils is deprecated, but as the code was working until today morning, can anyone please point me to the right fix?我没有足够的资源来找出解决方案,是的 distutils 已被弃用,但是由于代码一直工作到今天早上,任何人都可以指出正确的解决方法吗?

I'm getting the same error as you.我遇到了和你一样的错误。 Staging server setup last week works, production this week does not, same versions of python, same versions of the libraries.上周的登台服务器设置工作,本周的生产没有,相同版本的 python,相同版本的库。 Not sure what changed.不确定发生了什么变化。

Either way:无论哪种方式:

try adding this to your pip install:尝试将此添加到您的 pip 安装:

SETUPTOOLS_USE_DISTUTILS=stdlib pip install .... 

As mentioned from setuptools issuesetuptools 问题所述

I downgraded to setuptools==58.2.0 and now it works fine again.我降级到 setuptools==58.2.0 现在它又可以正常工作了。

restricting setuptools in CI help to get rid of this regression https://github.com/celery/kombu/commit/c4a8c2a69f0caad080984e466a5ccdb4be068373 https://github.com/celery/kombu/pull/1466在 CI限制setuptools有助于摆脱这种回归

Also removing the distutils hack from setup.py is still under consideration in near future https://github.com/celery/kombu/pull/1467 .此外,在不久的将来https://github.com/celery/kombu/pull/1467中,仍在考虑从 setup.py 中删除 distutils hack。

ref Including non-Python files with setup.py ref 包括带有 setup.py 的非 Python 文件

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

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