Python 错误:找不到满足json==1.0.0要求的版本
我试图在Heroku上托管我的discord bot(用Python编码),但我面临这个错误。如何在requirements.txt中正确包含json包 bot.py文件Python 错误:找不到满足json==1.0.0要求的版本,python,json,requirements.txt,Python,Json,Requirements.txt,我试图在Heroku上托管我的discord bot(用Python编码),但我面临这个错误。如何在requirements.txt中正确包含json包 bot.py文件 from discord.ext import commands import json def get_prefix(client, message): with open("prefixes.json", "r") as f: prefixes = jso
from discord.ext import commands
import json
def get_prefix(client, message):
with open("prefixes.json", "r") as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
git+https://github.com/Rapptz/discord.py
dnspython==1.16.0
PyNaCl==1.3.0
async-timeout==3.0.1
json==1.0.0
requirements.txt文件
from discord.ext import commands
import json
def get_prefix(client, message):
with open("prefixes.json", "r") as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
git+https://github.com/Rapptz/discord.py
dnspython==1.16.0
PyNaCl==1.3.0
async-timeout==3.0.1
json==1.0.0
您不需要安装json模块,因为它是一个 只需导入json,它就可以开箱即用。如果您使用的是其他JSON库,那么它可能不会被命名为
JSON
,因为Python已经有了它。您必须在PyPi中搜索包的正确名称:
此外,您似乎正在手动创建requirements.txt。你不应该这样做。最好不要这样做,因为您可能会丢失包或编写不正确的包(如此json模块)。您可以使用:
$pip freeze>requirements.txt
$cat requirements.txt
aiohttp==3.7.3
appnope==0.1.2
异步超时==3.0.1
属性==20.3.0
回叫==0.2.0
certifi==2020.12.5
chardet==3.0.4
点击==7.1.2
数据大小==1.0.0
装饰器==4.4.2
弹性搜索==7.10.1
elasticsearch dsl==7.3.0
烧瓶==1.1.2
...
参见相关帖子:。你能告诉我们你写了什么代码吗?编辑了这篇帖子。是一个内置的Python模块。