[英]Import "discord" could not be resolved error
I'm trying to make a discord bot, and I keep getting this error: Import "discord" could not be resolved Pylance(reportMissingImports)
我正在尝试制作 discord 机器人,但我不断收到此错误:
Import "discord" could not be resolved Pylance(reportMissingImports)
I used this to install the package: py -3 -m pip install -U discord.py
我用它来安装 package:
py -3 -m pip install -U discord.py
I am using the cmd on Visual Studio Code for this.为此,我在 Visual Studio Code 上使用 cmd。 Can anyone help?
任何人都可以帮忙吗?
Try these steps:尝试以下步骤:
Run VS Code as administrator > Navigate to your project path in the Terminal (CMD) in VS Code > Then Run the command py -3 -m pip install -U discord.py
以管理员身份运行 VS Code > 在 VS Code 的终端(CMD)中导航到您的项目路径 > 然后运行命令
py -3 -m pip install -U discord.py
If Step 1 doesn't work, Open the Command Prompt as administrator from the Windows System (Not in VS Code) > Navigate to the project path & Run that same command.如果步骤 1 不起作用,请从 Windows 系统(不在 VS Code 中)以管理员身份打开命令提示符 > 导航到项目路径并运行相同的命令。
Note: Make Sure you have installed the latest Python 3.x version注意:确保您已安装最新的Python 3.x版本
First, you should use the following command to install the discord package.首先,您应该使用以下命令安装discord package。
pip install discord
Secondly, maybe there are multiple python environments on your machine, please use Ctrl + Shift + P to open the command palette, then search and select Python:Select Interpreter , and select the correct interpreter. Secondly, maybe there are multiple python environments on your machine, please use Ctrl + Shift + P to open the command palette, then search and select Python:Select Interpreter , and select the correct interpreter.
There are two ways to be right here有两种方法可以在这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.