python - discordpy 无法使用 pip 安装
问题描述
我一直在尝试安装discordpy,pip install discordpy
但收到以下消息:
pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pip install discordpy
+ ~~~
+ CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我在 cmd 和 windows power shell 中都这样做了,在 cmd 中,我得到的错误是:
'pip' 不是内部或外部命令、可运行程序或批处理文件。
我尝试了很多在 Stack Overflow 上发现的东西,但没有任何效果。我使用的 Python 版本是 3.7。
解决方案
由于 pip 与更高版本的 python(>3.4) 捆绑在一起,因此您可以将 pip 作为 python 的方法运行。
因此,不要使用安装> pip install discord.py
,而是使用> python -m -3.7 pip install discord.py[voice]
-3.7
如果您有多个 python 版本,该标签会告诉您要安装到哪个版本。例如,如果您使用的是 3.8,则应使用-3.8
标签
Voice 用于语音支持,它只是将 PyNaCl 添加到其依赖项列表中,如果您不与 VoiceChannels 交互,它是完全可选的。
一个常见的误解是不要pip install discord
仅仅因为它说 v1.0.1 而做,但实际上,discord
它只是discord.py
PyPi 上的镜像包,因为如果你看得更深,discord.py
它是discord
. 但是,仍然建议安装discord.py
overdiscord
如果您使用的是 VENV(虚拟环境),请使用 IDE 附带的包管理器或命令行进行安装。
推荐阅读
- python - 在多个异步循环中使用相同的 websocket 连接(Python)
- macos - 如何在 SwiftUI 生命周期中使用 NSToolbar
- django-views - 将函数基础视图转换为 Django 中的类基础视图
- javascript - 从传单定位控件获取坐标
- kotlin - 我的 RecyclerView 的 addOnScrollListener 没有按预期工作
- python - 找不到 Pyimagesearch 模块
- sql - 如何在 SQL 查询中使用 Row_Number
- javascript - 如何在闪亮的应用程序中观察 JavaScript 按钮
- graphics - 是否能够在一个包含一个管道的渲染通道中调用 vkCmdDrawIndexed 的多个绘制调用?
- javascript - 加载页面时出错(在引导模板的 js 上)