I opened command prompt (I'm on Windows) and I typed:
'''none pip3 install discord '''
Then it said it installed discord, and I was ready to go! (I already had Python 3.9.7 installed)
Then when I opened VSCode up and typed: import discord
I got this error message:
"discord" is not accessedPylance
Import "discord" could not be resolvedPylancereportMissingImports
What does this mean, and how can I fix it? I was really looking forward to coding the bot, but don't know how, now that this is messed up.
CodePudding user response:
check in the bottom left corner of the VS Code window for which version of Python is it using. This issue usually occurs for me when I’m working in a virtual environment but VS Code is pointing to my global Python installation.
CodePudding user response:
You can change the Python Interpreter
in VSCODE
to solve this issue.
- Open settings in
VSCODE
by pressingCtrl
Shift
P
. Make sure your.py
file is open while doing this step.
Search there
Python: Select Interpreter
and choose the right version.Reload
VSCODE
and see if it works!
CodePudding user response:
Open an integrated Terminal in VS Code,
run
python --version
, it should bepython3.9.7
which is selected as python interpreter and shown in status bar.run
pip show discord
to check if its location is\..\python3.9.3\lib\site-packages
. If not, reinstall it.