gpt4 book ai didi

python - Heroku 上的全新部署失败,出现 "use --allow-unverified PIL to allow"

转载 作者:太空狗 更新时间:2023-10-30 00:22:19 25 4
gpt4 key购买 nike

尝试将 Django 项目部署到 Heroku 上的新应用程序(过去两年代码在其他实例上运行)- 并遇到了这个问题:

   Downloading/unpacking PIL==1.1.7 (from -r requirements.txt (line 7))

Could not find any downloads that satisfy the requirement PIL==1.1.7 (from -r requirements.txt (line 7))

Some insecure and unverifiable files were ignored (use --allow-unverified PIL to allow).
Cleaning up...

No distributions at all found for PIL==1.1.7 (from -r requirements.txt (line 7))
Storing debug log for failure in /app/.pip/pip.log

! Push rejected, failed to compile Python app

我知道 pip 最近的变化,并且想使用安全的包,但是在所有包都按照 pip 的期望正确打包之前,我们需要一些解决方法。尤其是缺少 --allow-all-unverified 标志使得这是一种通过黑盒练习而不是无痛部署的反复试验。

有没有明智的方法来克服这个障碍? (不只是 PIL,但这是第一个失败的包,如果我设法解决这个问题,还有其他几个像 pyPdf 这样的包也会失败)

感谢任何指 pip !

最佳答案

我问了 pip 的维护者,他回答了一个简单的解决方案。作为对我自己的问题的回应,我正在详细说明如何去做。这是您现在需要做的事情 - 直到包在内部托管并经过验证。

在本地机器上,创建一个新的虚拟环境并在 requirements.txt 文件顶部添加一行:

--allow-all-external

保存并运行:

pip install -r requirements.txt --download="~/temp/packages"

这只是简单地从 requirements.txt 中获取每个包名称并将包下载到 ~/temp/packages 目录并验证它。

对于每个验证失败的包,在 requirements.txt 中添加另一行,就在允许所有外部包的第一行下方,如下所示:

--allow-unverified package-name

你可能想联系维护者来解决这个问题;)

继续直到 pip 成功完成,然后将更新后的 requirements.txt 提交到 vcs 并部署。

应该就这些了。<​​/p>

关于python - Heroku 上的全新部署失败,出现 "use --allow-unverified PIL to allow",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21958382/

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