I’m trying to make a discord bot, and I keep getting this error:
Import "discord" could not be resolved Pylance(reportMissingImports)
I used this to install the package:
py -3 -m pip install -U discord.py
I am using the cmd on Visual Studio Code for this. Can anyone help?
2
Answers
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
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.
Note: Make Sure you have installed the latest Python 3.x version
First, you should use the following command to install the discord package.
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