gpt4 book ai didi

django - Pipenv 无法在远程服务器 (Heroku) 上安装 boto3

转载 作者:行者123 更新时间:2023-12-04 10:20:16 25 4
gpt4 key购买 nike

我成功部署了我的 django 项目,然后我想使用 AWS S3 来提供静态文件。所以我安装了所需的软件包,一切都在本地运行。但是现在当我尝试时 git push heroku master它因以下回溯而失败:

Writing objects: 100% (370/370), 5.85 MiB | 2.92 MiB/s, done.
Total 370 (delta 69), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Python has released a security update! Please consider upgrading to python-3.6.10
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: cp: cannot create regular file '/app/tmp/cache/.heroku/requirements.txt': No such file or directory
remote: -----> Installing python-3.6.9
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18…
remote: Installing dependencies from Pipfile.lock (acd4c8)…
remote: An error occurred while installing boto3==1.12.31! Will try again.
remote: Installing initially–failed dependencies…
remote: Collecting boto3==1.12.31
remote: Using cached https://files.pythonhosted.org/packages/2a/4f/3facbb42e8d07db1ef9b8cefb28dd1dbfcd52a8e32a0323d57f59b10e147/boto3-1.12.31-py2.py3-none-any.whl
remote:
remote: THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock!. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
remote: boto3==1.12.31 from https://files.pythonhosted.org/packages/2a/4f/3facbb42e8d07db1ef9b8cefb28dd1dbfcd52a8e32a0323d57f59b10e147/boto3-1.12.31-py2.py3-none-any.whl#sha256=8bf7e3611d46e8214bf225169ac55de762d9d341514f81ebae885dd601138fcf (from -r /tmp/pipenv-sdy5o9v6-requirements/pipenv-k_8vold6-requirement.txt (line 1)):
remote: Expected sha256 913fc7bbb9df147ed6fa0bd2b391469652ee8cad3e26ca2355e6ff774d9516fb
remote: Got 8bf7e3611d46e8214bf225169ac55de762d9d341514f81ebae885dd601138fcf
remote:
remote: You are using pip version 9.0.2, however version 20.0.2 is available.
remote: You should consider upgrading via the 'pip install --upgrade pip' command.
remote:
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to shielded-coast-69749.
remote:
To https://git.heroku.com/shielded-coast-69749.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shielded-coast-69749.git'

以前我在尝试在本地安装 psycopg2 时遇到了类似的问题,但经过多次尝试后,除了解决方法(改为安装 psycopg2-binary)外,仍然没有找到任何东西。所以在这里我也觉得有点绝望。我试过 pipenv sync , pipenv update ,最终我用一个新的 venv 重新启动,但它没有帮助。如果我尝试通过 heroku 的 bash 安装 boto3,它会起作用。但这并不能解决问题,因为文件已被锁定。

最佳答案

django-storages 依赖于 1.4.4 及更高版本的 boto3 版本,但 pipenv 安装了 3 月 28 日发布的 1.12.31。所以 heroku 和 pypi.org 之间可能存在缓存不匹配。所以你可以通过使用以下命令手动安装 boto3 来降级 boto3
pipenv install "boto=1.4.4"
我指定了 1.4.4,因为它是 django-storages 所需的最低版本。但是您可以安装 1.4.4 以上的任何版本。

关于django - Pipenv 无法在远程服务器 (Heroku) 上安装 boto3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60895639/

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