简体   繁体   English

最近安装了 python 3.8,我正在尝试安装 py -3 -m pip install -U discord.py 使用空闲

[英]installed python 3.8 recently and i am trying to install py -3 -m pip install -U discord.py using the idle

so I keep trying to install discord.py via windows with this command as its shown on GitHub with python 3.8 idle所以我一直尝试使用此命令通过 windows 安装 discord.py,如 GitHub 和 Z23EEEB4343BDD7526BFCZ6B37EE9 idle 所示。

>>> py -3 -m pip install -U discord.py

but I just get nothing but invalid syntax here and I'm unsure as to why its saying this, I've followed this guide step by step but nothing works但我在这里只得到无效的语法,我不确定它为什么这么说,我一步一步地遵循了这个指南,但没有任何效果

image of error错误图片

okay ive also run the command via powershell and cmd.exe and both have not worked just attempted the sub process route you suggested and all I get a is file not found error好的,我还通过 powershell 和 cmd.exe 运行命令,两者都没有工作只是尝试了你建议的子进程路线,我得到的只是文件未找到错误

There are two types of console: windows and python.控制台有两种类型:windows 和 python。

Windows commands are typed into the windows console ( cmd.exe from the start menu). Windows 命令输入到 windows 控制台(开始菜单中的cmd.exe )。 This looks like这看起来像

C:\path\to\folder>

and python commands (really, lines of code) are typed into a python console, which looks like和 python 命令(实际上是代码行)被输入到 python 控制台,看起来像

>>>

You are typing a windows command into a python console, which won't work.您在 python 控制台中键入 windows 命令,但该命令不起作用。

If you run py -3 at a Windows console then you will start a python process and get a python console.如果您在 Windows 控制台上运行py -3 ,那么您将启动 python 进程并获得 python 控制台。

You can run Windows commands from a python console by using python's subprocess library:您可以使用 python 的subprocess进程库从 python 控制台运行 Windows 命令:

import subprocess
subprocess.run("py -3 -m pip install -U discord.py")

You can use CMD to install your dependency.您可以使用 CMD 来安装您的依赖项。 Run it in CMD在 CMD 中运行
Command: py -3 -m pip install -U discord.py命令: py -3 -m pip install -U discord.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM