gpt4 book ai didi

python - 作为 pip install 用户,我应该安装轮子吗?

转载 作者:行者123 更新时间:2023-12-04 13:08:13 26 4
gpt4 key购买 nike

考虑通常的场景 - 我想创建一个虚拟环境并安装一些包。说

python3 -m venv venv
source venv/bin/activate
pip install databricks-cli
在安装过程中,我收到一个错误
Building wheels for collected packages: databricks-cli
Building wheel for databricks-cli (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/paulius/Documents/wheeltest/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py'"'"'; __file__='"'"'/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-maxix98x
cwd: /tmp/pip-install-m7jmyh1m/databricks-cli/
Complete output (8 lines):
/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py:24: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for databricks-cli

虽然它是良性的(安装确实有效),但它仍然很烦人。
我知道 pip install wheel解决了这个问题,但是 wheel默认情况下不附带虚拟环境。所以我应该总是将它添加到我的 requirements.txt 中,或者这可能是包维护者可以解决的问题(在这种情况下 databricks-cli ),因此我应该在他们的 Github 中打开一个问题?

更新:请注意 wheel不需要安装轮子,在这个例子中,一堆依赖项被成功下载并安装为轮子。唯一的 databricks-cli 包出现错误,因为它没有轮子,但出于某种原因,pip 尝试构建它。

最佳答案

更新 3:
为了从维护者的角度防止它使用:

setup_requires=["wheel"]
看起来您在 Linux 上并使用预安装或以其他方式修改的 Python 及其 setuptools .
由于 Debian 以不太理智的方式切断了部分软件包,我也遇到过同样的事情,而且我主要遇到了预建 python-setuptools 的问题。和喜欢。检查版本是否匹配,如果不匹配,请从 pip 安装 setuptools,这在将来可能会有所帮助。
我有安装工具 45.2.0并且将软件包安装为轮子没有问题。然后我卸载了wheel并删除了缓存目录,即使从 the tar.gz source它也正确安装了它.
更新 2:
它可能会或可能不会通过要求 wheel 来解决。包裹。如果 setup.py预计 bdist_wheel在安装之前存在(最有可能),将其添加到 setup()功能将无济于事,并且需要在安装脚本中手动检查包(+ 可能是自述文件中的引用),以便最终用户可以正确安装它。
例如,如果它不存在于系统中,只需打印警告并拨打 exit() .这将是维护者应该做的最少的事情。

更新:
是的,在遇到 bdist_wheel的情况下缺少命令,您需要使用 pip instal wheel 安装轮子.

这不是必需的,但建议这样做。 Pip 在没有轮子的情况下也能正常工作,但您将从源代码( tar.gz.zip.egg )进行安装。
the packaging discussion是否使用车轮或鸡蛋(或来源)。

关于python - 作为 pip install 用户,我应该安装轮子吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68375133/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com