在 python3.6 上导入 yarl 或 discord.py 时出现问题 [英] Problem importing yarl or discord.py on python3.6

查看:24
本文介绍了在 python3.6 上导入 yarl 或 discord.py 时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于概述的错误,我最近更新了 discord.py 在这篇文章中,更新后我无法再导入它.

I recently updated discord.py due to an error outlined in this post and after updating it I can no longer import it.

运行 import discord 出现以下错误:

Running import discord brings up the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/discord/__init__.py", line 23, in <module>
    from .client import Client
  File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 34, in <module>
    import aiohttp
  File "/usr/local/lib/python3.6/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import BaseConnector as BaseConnector
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 30, in <module>
    from yarl import URL
  File "/usr/local/lib/python3.6/site-packages/yarl/__init__.py", line 1, in <module>
    from ._url import URL, cache_clear, cache_configure, cache_info
  File "/usr/local/lib/python3.6/site-packages/yarl/_url.py", line 56, in <module>
    @rewrite_module
  File "/usr/local/lib/python3.6/site-packages/yarl/_url.py", line 132, in URL
    _QUERY_PART_QUOTER = _Quoter(safe="?/:@", qs=True, requote=False)
  File "yarl/_quoting.pyx", line 192, in yarl._quoting._Quoter.__init__
TypeError: __init__() got an unexpected keyword argument 'requote'

列表中的最后一件事是 yarl,所以我尝试了 import yarl 并得到了这个错误:

The last thing on the list was yarl, so I tried an import yarl and got this error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/yarl/__init__.py", line 1, in <module>
    from ._url import URL, cache_clear, cache_configure, cache_info
  File "/usr/local/lib/python3.6/site-packages/yarl/_url.py", line 56, in <module>
    @rewrite_module
  File "/usr/local/lib/python3.6/site-packages/yarl/_url.py", line 132, in URL
    _QUERY_PART_QUOTER = _Quoter(safe="?/:@", qs=True, requote=False)
  File "yarl/_quoting.pyx", line 192, in yarl._quoting._Quoter.__init__
TypeError: __init__() got an unexpected keyword argument 'requote'

python的版本是3.6.8.我也在另一台 3.6.9 的机器上尝试过这个,得到了同样的错误.我已经在 3.7.7 的机器上尝试过这个并且一切正常加载,但是我没有能力在这台机器上将 python 升级到 3.7,所以想让它在 3.6 上工作.

The version of python is 3.6.8. I've also tried this on a different machine with 3.6.9 and got the same error. I've tried this on a machine with 3.7.7 and everything loaded normally, but I do not have the ability to upgrade python to 3.7 on this machine and so would like to get it to work on 3.6.

推荐答案

升级 pip 对我没有帮助.

Upgrading pip did not help me.

如@Orangutan 所示,强制重新安装 yarl 对我没有帮助.

Forcing the reinstall of yarl as shown by @Orangutan did not help me.

但是,以下方法成功了:

However, the following did the trick:

mkdir ~/backup
mv ~/.local/lib/python3.6/site-packages/yarl* ~/backup/
pip3 install yarl --force-reinstall --no-cache-dir

这篇关于在 python3.6 上导入 yarl 或 discord.py 时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆