gpt4 book ai didi

python - 类型错误 : Inheritance a class from URL is forbidden

转载 作者:太空狗 更新时间:2023-10-29 21:27:51 27 4
gpt4 key购买 nike

我在尝试运行我为 Discord 制作的机器人时遇到了这个错误。这是在下载一些模块后发生的。有什么办法可以解决这个问题吗?

Traceback (most recent call last):
File "C:\Users\Jeriel\Desktop\JerryBot\run.py", line 1, in <module>
import discord
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\discord\__
init__.py", line 20, in <module>
from .client import Client, AppInfo
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\discord\cl
ient.py", line 30, in <module>
from .guild import Guild
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\discord\gu
ild.py", line 39, in <module>
from .channel import *
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\discord\ch
annel.py", line 31, in <module>
from .webhook import Webhook
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\discord\we
bhook.py", line 27, in <module>
import aiohttp
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\aiohttp\__
init__.py", line 6, in <module>
from .client import * # noqa
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\aiohttp\cl
ient.py", line 15, in <module>
from . import connector as connector_mod
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\aiohttp\co
nnector.py", line 17, in <module>
from .client_proto import ResponseHandler
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\aiohttp\cl
ient_proto.py", line 6, in <module>
from .http import HttpResponseParser, StreamWriter
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\aiohttp\ht
tp.py", line 8, in <module>
from .http_parser import (HttpParser, HttpRequestParser, HttpResponseParser,

File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\aiohttp\ht
tp_parser.py", line 15, in <module>
from .http_writer import HttpVersion, HttpVersion10
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\aiohttp\ht
tp_writer.py", line 304, in <module>
class URL(yarl.URL):
File "C:\Users\Jeriel\AppData\Roaming\Python\Python36\site-packages\yarl\__ini
t__.py", line 230, in __init_subclass__
"is forbidden".format(cls))
TypeError: Inheritance a class <class 'aiohttp.http_writer.URL'> from URL is for
bidden

最佳答案

Discord.py 重写分支最近在其 requirements.txt 和 aiohttp 支持方面存在一些问题。需要手动安装低版本的yarl来支持discord.py所需的aiohttp库。

您需要运行以下命令:

pip install "yarl<1.2"

更新

新版本的discord.py rewrite 修复了这个问题,您不再需要按照上述解决方案进行操作。正确的做法是从 GitHub 重新下载 discord.py rewrite 并升级包。

关于python - 类型错误 : Inheritance a class from URL is forbidden,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50165167/

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