Discord.py not being detected in vscode - python

I had installed discord.py in cmd like so, pip install discord.py, but whenever I type import discord in vscode, It doesnt seem to detect it and gives the error "Import "discord" could not be resolved". I also made a new terminal in vscode and typed in pip install discord.py, and it said that all requirements were fulfilled! How can I import and use discord in vscode??

Please install the required modules in the currently selected environment:
(You could use the shortcut key Ctrl+Shift+` to open a new VSCode terminal, it will automatically enter the current Python environment)
Please check the source of the installation tool pip, the module is installed here:
Run:
check:
Reference: discord.py and environment in VSCode.

Related

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)
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?
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.
And then restart the VS Code and check!
Note: Make Sure you have installed the latest Python 3.x version
First, you should use the following command to install the 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.
There are two ways to be right here
Select the interpreter environment where you successfully installed the discord package earlier
Choose an interpreter environment you want to use, then create a new terminal to activate the environment, and install the discord package for your new environment.

Pycharm : Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings

I was trying to get Django installed onto my Pycharm.
In Terminal, I typed in
python -m pip install Django
When I pressed enter on the information,
It told me:
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
I already have Python installed and put it as the base interpreter for the file. Not sure why Pycharm wants me to install it from the Microsoft store???
Please help!
Either search for the exe und run it like {pathtoexe}/python.exe -m pip install Django or try python3instead of python. In addition to that you can check your path variables where you should find the actual command.

How can I add the Discord module in python without using pip?

How are you guys?
So to get straight to the point I wanted to create a Discord bot using Python but the thing is that when I want to install the discord module using pip by typing pip install discord but since I'm using a PC without admin rights I have an error saying that it can't launch this program (pip)
So I'm here to ask if anyone knows how can I install the Discord module in python without pip ?
Thanks in advance!
~Sami
It depends on which IDE you are using
For example, you can download pycharm if you don't already have it and you can download the package from pycharm itself.
How you can do that is going to file ➜ Settings ➜ Project ➜ Python Interpreter ➜ and click the + sign over the package label and there you will be able to search for any package you want like discord.py
Go to https://github.com/Rapptz/discord.py and download it as a zip (Code -> Download ZIP)
Extract the zip file on your desktop
Open the command propmt and CD into the discord.py-master directory (with cd Desktop\discord.py-master
Run python setup.py install
You can try using
py -m pip install discord
Try this
set PATH=%PATH%;C:\Python34\Scripts
check this link for more 'pip' is not recognized as an internal or external command
If the above doesn't work
You have to download the discord.py module here.
https://pypi.org/project/discord.py/#files
and read this if you don't know how to import files
How do I use an external .py file?
else
reinstall python and set the path like the below image
https://miro.medium.com/max/1282/1*ecMIFT0gDLcLRD1y5q8_Tg.png

discord py in Visual Studio Code not detecting extension

I installed discord.py with the voice and without in the visual studio code terminal because in my cmd it doesn't detect pip like a command (I'm on windows). I've tried too in the python terminal but it doesnt detetect pip like a command.
Please help.
Pip is installed, it's just not installed as a command, and that's on purpose. What you want to do is create a virtual environment and then install into there by activating the environment and then using python -m pip.

Why is pip not working even though its in command line and using -m?

I am trying to code a bot for discord and I need to run python -m pip install youtube_dl, but whenever I do, I always receive a syntax error on the pip part. I am running it in command line, and I'm fairly certain I set the path to wher python is installed, but it's still not working. Any ideas?
try running pip install youtube_dl as admin

Categories

Resources