Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 views
in Technique[技术] by (71.8m points)

python - i have download discord package but its not working in vscode

I have download discord in command prompt but when I type import discord in vscode it cant find the file. I have tried uninstalling and reinstalling it. What do i do? If i run a code this pops up

No module named 'discord'

question from:https://stackoverflow.com/questions/65911378/i-have-download-discord-package-but-its-not-working-in-vscode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You either forgot to add python to the path or are using the wrong environment. strong text

while installing python, this option pops up. or you simply are using the wrong environment. enter image description here

enter image description here

enter image description here

above, in the environment select the python version you will be using (in the existing environment tab)

if your issue was with you not adding python to the path, after doing so, you have to run pip install discord again. If you are unsure about "if" you have added python to the path or not, simply open your cmd prompt and type python to check so. If it looks like the one below, then it is added to the path.

hope that helps

also, don't forget to import the following:

import discord
import discord.utils

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...