gpt4 book ai didi

python - 我可以把鸡蛋变成轮子吗?

转载 作者:太空狗 更新时间:2023-10-29 17:57:58 25 4
gpt4 key购买 nike

我有一个已经构建/下载的 Python egg,我想将它转换为 PEP 427 中记录的 wheel 格式.
我该怎么做?

最佳答案

答案是肯定的。
我们只需要 wheel包,我们甚至不需要安装它,根据 docs , 我们可以直接使用它(由于 .whl 文件与 .zip 文件的格式相同,Python 可以直接运行 .zip 文件中的代码):

pdobrogost@host:~$ python ./wheel-0.22.0-py2.py3-none-any.whl/wheel -h
usage: wheel [-h]

{keygen,sign,unsign,verify,unpack,install,install-scripts,convert,version,help}
...

positional arguments:
{keygen,sign,unsign,verify,unpack,install,install-scripts,convert,version,help}
commands
keygen Generate signing key
sign Sign wheel
unsign Remove RECORD.jws from a wheel by truncating the zip
file. RECORD.jws must be at the end of the archive.
The zip file must be an ordinary archive, with the
compressed files and the directory in the same order,
and without any non-zip content after the truncation
point.
verify Verify a wheel. The signature will be verified for
internal consistency ONLY and printed. Wheel's own
unpack/install commands verify the manifest against
the signature and file contents.
unpack Unpack wheel
install Install wheels
install-scripts Install console_scripts
convert Convert egg or wininst to wheel
version Print version and exit
help Show this help

optional arguments:
-h, --help show this help message and exit

现在,我们所要做的就是使用 convert参数并传递 egg 进行转换:

pdobrogost@host:~$ python ./wheel-0.22.0-py2.py3-none-any.whl/wheel convert ./my-egg.egg

感谢 Paul Moore 提供 answer在 virtualenv 的小组和 Ivo 上提供有关#pip irc channel 的更多详细信息。

关于python - 我可以把鸡蛋变成轮子吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21856048/

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