首页 > 解决方案 > Python-Heroku - aiohttp 3.7.3 要求 chardet<4.0,>=2.0,但您将拥有不兼容的 chardet 4.0.0

问题描述

我刚开始使用 git 和 heroku,我想让我的文件在 heroku 24/7 上在线,但是在将文件上传到 heroku(git push heroku master)时,这出现了

aiohttp 3.7.3 has requirement chardet<4.0,>=2.0, but you'll have chardet 4.0.0 which is incompatible.

我真的认为这是一个 python 版本问题,所以当我尝试使用 aruntime.txt并将 python 版本设置为https://devcenter.heroku.com/articles/python-support#supported-runtimes此页面上的支持版本之一时,仍然它不起作用并显示

Requested runtime (python=3.7.9) is not available for this stack (heroku-20).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support

我是第一次使用 git,所以不太好用。我只在一个名为 master 的分支上工作,我先输入

git add .

然后

git commit -am "tej"

然后

git push heroku master

不,我不在 github repo 上工作。

标签: pythongitheroku

解决方案


我遇到了同样的问题,但设法通过在 requirements.txt 中将 chardet 的版本指定为 3.0.4 来解决它

chardet==3.0.4

然后简单地运行

pip install -r requirements.txt

一切都会好起来的。


请注意,如果您在 requirements.txt 中使用以下 chardet 版本,您也会收到该错误

chardet==4.0.0

在此处输入图像描述


推荐阅读