(Python:discord.py)错误:无法为使用 PEP 517 且无法直接安装的 multidict、yarl 构建***

Posted

技术标签:

【中文标题】(Python:discord.py)错误:无法为使用 PEP 517 且无法直接安装的 multidict、yarl 构建***【英文标题】:(Python: discord.py) ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly 【发布时间】:2021-02-06 08:38:55 【问题描述】:

尝试使用 pip install 下载 discord.py,在标题中给了我错误消息。 我使用 cmd 和命令 py -m pip install -U discord 安装,该 cmd 也在管理员中运行。 尝试使用 pip、pip3 和 pip3.9,均无效。

我尝试卸载/重新安装/升级(按此顺序)上述库:

点 亚尔 多字典 *** 设置工具

我尝试过的 python 版本(所有版本都使用默认设置下载,没有任何改变): python-3.9.0-amd64.exe python-3.9.0.exe

我尝试研究***并尝试使用 --no-binary :all: 进行安装,但它在下面给出了相同的错误消息。

在我尝试过的所有迭代中,它产生了完全相同的错误消息,没有任何偏差

请帮忙:

  Using cached discord-1.0.1-py3-none-any.whl (1.1 kB)
Collecting discord.py>=1.0.1
  Using cached discord.py-1.5.1-py3-none-any.whl (701 kB)
Processing c:\users\mt\appdata\local\pip\cache\wheels\b6\9c\bd\6b99bc6ec9dab11f3756d31fb8506d3ecf07aea58b6201f539\aiohttp-3.6.3-py3-none-any.whl
Collecting attrs>=17.3.0
  Using cached attrs-20.2.0-py2.py3-none-any.whl (48 kB)
Collecting chardet<4.0,>=2.0
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting async-timeout<4.0,>=3.0
  Using cached async_timeout-3.0.1-py3-none-any.whl (8.2 kB)
Collecting yarl<1.6.0,>=1.0
  Using cached yarl-1.5.1.tar.gz (173 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting multidict<5.0,>=4.5
  Using cached multidict-4.7.6.tar.gz (50 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting idna>=2.0
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Building wheels for collected packages: yarl, multidict
  Building wheel for yarl (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\mt\appdata\local\programs\python\python39\python.exe' 'c:\users\mt\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\MT\AppData\Local\Temp\tmptlhkh7zi'
       cwd: C:\Users\MT\AppData\Local\Temp\pip-install-nztu4nu2\yarl
  Complete output (35 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_py.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_url.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\__init__.py -> build\lib.win-amd64-3.9\yarl
  running egg_info
  writing yarl.egg-info\PKG-INFO
  writing dependency_links to yarl.egg-info\dependency_links.txt
  writing requirements to yarl.egg-info\requires.txt
  writing top-level names to yarl.egg-info\top_level.txt
  reading manifest file 'yarl.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files matching '*.cache' found anywhere in distribution
  warning: no previously-included files found matching 'yarl\*.html'
  warning: no previously-included files found matching 'yarl\*.so'
  warning: no previously-included files found matching 'yarl\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'yarl.egg-info\SOURCES.txt'
  copying yarl\__init__.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.c -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyx -> build\lib.win-amd64-3.9\yarl
  copying yarl\py.typed -> build\lib.win-amd64-3.9\yarl
  running build_ext
  building 'yarl._quoting_c' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for yarl
  Building wheel for multidict (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\mt\appdata\local\programs\python\python39\python.exe' 'c:\users\mt\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\MT\AppData\Local\Temp\tmpzb98brnr'
       cwd: C:\Users\MT\AppData\Local\Temp\pip-install-nztu4nu2\multidict
  Complete output (40 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\multidict
  copying multidict\_abc.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_compat.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_base.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_py.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\__init__.py -> build\lib.win-amd64-3.9\multidict
  running egg_info
  writing multidict.egg-info\PKG-INFO
  writing dependency_links to multidict.egg-info\dependency_links.txt
  writing top-level names to multidict.egg-info\top_level.txt
  reading manifest file 'multidict.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files found matching 'multidict\_multidict.html'
  warning: no previously-included files found matching 'multidict\*.so'
  warning: no previously-included files found matching 'multidict\*.pyd'
  warning: no previously-included files found matching 'multidict\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'multidict.egg-info\SOURCES.txt'
  copying multidict\__init__.pyi -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict.c -> build\lib.win-amd64-3.9\multidict
  copying multidict\py.typed -> build\lib.win-amd64-3.9\multidict
  creating build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\defs.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\dict.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\istr.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\iter.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\pair_list.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\views.h -> build\lib.win-amd64-3.9\multidict\_multilib
  running build_ext
  building 'multidict._multidict' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for multidict
Failed to build yarl multidict
ERROR: Could not build wheels for yarl, multidict which use PEP 517 and cannot be installed directly```

【问题讨论】:

您是否按照错误消息中的说明进行操作?需要 Microsoft Visual C++ 14.0 或更高版本。使用“Microsoft C++ 构建工具”获取它:visualstudio.microsoft.com/visual-cpp-build-tools 跟随它并且它起作用了......我一定没有正确阅读错误消息。谢谢。 Discord.py v1.6 已于今天早些时候发布,修复了此问题 安装 GCC > 用于 debian linux 基础镜像。 【参考方案1】:

我在一个带有 yarl、multidict 依赖项的包中遇到了类似的问题。为了修复它,我刚刚升级了我的 pip:

pip install --upgrade pip
pip install discord

【讨论】:

pip install --upgrade pip 为我解决了一个与不和谐相关的问题!【参考方案2】:

2021 年 1 月 8 日更新:Discord.py v1.6 已发布,变更日志中包含构建***的依赖项中的一个凸起

下面的旧消息

如果你想留在 3.9:

安装 Devon 的 aiohttp、multidict、yarl 和 PyNaCl (https://github.com/Rapptz/discord.py/issues/5984#issuecomment-727684359) 的个人版本,例如: py -3.9 -m pip install --upgrade discord.py[voice] --extra-index-url https://gorialis.github.io/pip/ 安装 Micosoft Visual C++ 独立编译器 (https://wiki.python.org/moin/WindowsCompilers) 并尝试在本机工具命令提示符中安装 discord.py 从 master 分支 (https://github.com/Rapptz/discord.py#installing) 上的最新开发版本 discord.py 安装,例如: py -3.9 -m pip install --upgrade "discord.py[voice] @ git+git://github.com/Rapptz/discord.py.git" 从 https://www.lfd.uci.edu/~gohlke/pythonlibs/ 上的预编译***安装 multidict 和 yarl(请注意,此处不提供用于语音支持的 PyNaCl) 安装最新版本的discord.py的依赖并安装不依赖的discord.py,例如: py -3.9 -m pip install --upgrade aiohttp pynacl py -3.9 -m pip install --upgrade discord.py --no-dependencies 使用 Python 3.8,其中预构建的***可用于 discord.py v1.5.1 使用的依赖版本 等待 discord.py v1.6.0 发布(2021 年 1 月 8 日发布)

截至 2021 年 1 月 8 日最新

【讨论】:

【参考方案3】:

我今天也遇到了同样的问题,因为我下载了 node.js,它把我的 python 8 更新到了 python 9,我不得不重新安装我的所有模块,包括 dpy。

解决办法就是按照它说的去做

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

https://visualstudio.microsoft.com/visual-cpp-build-tools/

【讨论】:

没有为我解决问题;在得到这个答案之前我已经完成了所有这些,并且继续得到同样的错误。

以上是关于(Python:discord.py)错误:无法为使用 PEP 517 且无法直接安装的 multidict、yarl 构建***的主要内容,如果未能解决你的问题,请参考以下文章

使用 discord.py rewrite 创建即时邀请,似乎无法做到没有错误

由于 EnvironmentError 无法安装“discord.py”

无法为每个服务器 discord.py 获取自定义管理员角色

使用 discord.py 忽略 python3 中的机器人生成的错误

discord.py 后台任务循环的问题

尝试运行“ctx 是缺少的必需参数”的命令时收到错误消息。 [Python,discord.py]