You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Heroku上运行discord.py 2.0文件?安装指定版本遇报错

解决Heroku安装discord.py 2.0报错的方法

错误原因

你指定的discord.py==2.0.0a4422+gdc50736b是discord.py 2.0的开发预览版本,该版本未上传至PyPI官方源,因此pip无法找到匹配的安装包。

解决步骤

1. 修改requirements.txt文件

将原有的版本指定行替换为从GitHub源码安装的格式:

git+https://github.com/Rapptz/discord.py.git@2.0.0a4422+gdc50736b#egg=discord.py

若无需精确绑定该特定开发版本,也可直接安装2.x分支的最新开发版:

git+https://github.com/Rapptz/discord.py.git@master#egg=discord.py

2. 重新部署到Heroku

提交修改后的requirements.txt到本地Git仓库,再推送到Heroku:

git add requirements.txt
git commit -m "调整discord.py安装源"
git push heroku main

备选方案:使用正式发布的2.x版本

如果不需要特定开发预览版,直接指定PyPI上已发布的2.x稳定版即可:

discord.py>=2.0.0

此方式无需依赖Git,pip可直接从PyPI完成安装。

内容的提问来源于stack exchange,提问作者Ayush Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 15:45:32