No module named discord ошибка
To check the interpreter PyCharm is using, go to File > Settings > Project: name > Project Interpreter. Then, in the CMD prompt, run where python . If the two paths don't match, that's your problem.
9 Answers 9
Go into the terminal and use: pip uninstall discord.py wait a few seconds so it can fully delete it, and then use pip install discord.py . Should work
Can you please add examples of full commands one has to type? That would make you answer easier to use.
yea much better :) There's a problem with the backticks in the second piece of code. Using single backticks to enclose the code should work.
sudo pip install discord.py solves the problem
Maybe it's the Python version issue.
When I tried running in python3.8 I got the same error. Switched over to 3.6 and it worked.
Please don't write answers in a way that makes them look like questions. There are systems in place to check for Not An Answer (NAA) posts. This answer was falsely picked up by one of them. Please consider editing it to look more like an answer. Please remove "Not sure if this will help but maybe it's the python version the issue." and "Sorry for the late response :)" parts.
instead of installing discord.py. Hope this works!
check for python interpreter location in pycharm. Or install discord with sudo pip command
I imagine that your venv in pycharm and your environment in the command prompt have different packages installed. If the error is the program not running at command prompt try opening a command prompt and running pip install discord (pip must be in your PATH) to install it to your main python directory. You'll notice that in PyCharm if you open the terminal tab it says
with "(venv)" meaning a virtual environment is loaded here that can have packages installed to it without altering your main installation on your PC (usually located at C:\Program Files\Python 3.5). In order to run scripts from the command line, however, you will need the package to be installed in your main python directory which pip install discord will accomplish.
The text was updated successfully, but these errors were encountered:
sethwheway commented Aug 16, 2018
@Arthurdw For a start 3.5.6 so if you're going to get 3.5 use that. And second of all why do you think 3.4 and .3.5 are recommended. The Readme states 3.4.3+. There is no reason not to use 3.6.6 and you would be losing features and performance not using it.
mesub7 commented Jul 7, 2021 •
Please don't necrobump old, closed issues.
If you require support visit the discord server or go to the discussion page. I do use atom myself, so I would be willing to assist through the appropriate channels.
Arthurdw commented Aug 20, 2018
@ItWasAllIntended Thanks, I'm now running perfectly on 3.6.6!
I didn't use these code's tho for my bot.
appuchias commented Feb 14, 2019
I haven´t solved it yet.
The error message is:
import discord
ModuleNotFoundError: No module named 'discord'
I don´t have any Discord called folder and I have 3.7 Python and I have updated pip.
Has anyone an answer?
mross01 commented Mar 20, 2018
having same issue
Arthurdw commented Mar 19, 2019 •
*update for anyone who sees this.
Async will work till version 3.6.x.
If you want to have 3.7.x you will have to go the the rewrite libary, the rewrite libary has some other positive things too but it sacrifices the python 2.7.x support.
EDIT:
For anyone reading this, I recommend using the rewrite library as this library is currently being supported by the dev and community. Since support for python 2 will be dropped at the end of this year in general it makes sense to use the rewrite library instead of the async library.
Arthurdw commented Aug 16, 2018
@SilicalNZ @Harmon758
Do you suggest that I re-install Python from 3.7 to 3.5?
Harmon758 commented Aug 16, 2018
Are you importing it on the same Python version that you installed it on? i.e. Python 3.7
Also, Import discord with a capital I will raise a syntax error.
And as @SilicalNZ noted, the async branch will not work as is with your current setup on Python 3.7.
For further help, you should join either the official discord.py server or the Discord API server, as the README recommends.
sgtlaggy commented Dec 18, 2016 •
python3 -m pip install discord.py
ghost commented Jul 7, 2021
EvieePy commented Feb 14, 2019
I'm going to try and cover most of this here so that this stops being necro'd.
Firstly for those running PyCharm, beware that it is default behaviour for it to create a virtual environment in your project.
To avoid any issues simply run your pip commands in the PyCharm terminal, located on the bottom left. This should ensure your packages are being installed to the venv. If you do not want to use the venv, you can simply select a System Interpreter: File > Settings > Project > Project Interpreter > Little Cog (Top Right) > Add > System Interpreter.
Secondly, ensure you are not creating any files or folders named discord in your project. If you have any in your project, remove them, and try again.
Thirdly, ensure you are installing discord.py to the correct place.
On Linux/Mac:
python -m pip install discord.py
For example:
python3.7 -m pip install discord.py
On Windows:
py - -m pip install discord.py
For Example:
py -3.7 -m pip install discord.py
Lastly remember, if you install a package to Python version 3.7(and you want to use it). You must run your bot under Python 3.7.
For example:
python3.7 my_bot_file.py
If you are unsure if your version of Python has an installed package, you can use, for example:
python3.7 -m pip show package_name or python3.7 -m pip freeze (to show all installed packages).
The text was updated successfully, but these errors were encountered:
ccubed commented Dec 18, 2016
You both likely have a folder named discord in your project folder. Delete it. Rerun the command. This is probably a case of local overrides. To verify, move out of your project directory entirely and run the following commands:
If this works with no errors, you have a local override in your project. Delete the discord folders in there.
simdimdim commented Jul 22, 2017
@ccubed very helpful, that was exactly the case with my pythonic 'project', thanks for the headsup.
"Модуль" Discord "не найден" в Python3.x во время установки PIP
У меня есть небольшой вопрос: мой босс Discord написан на Python, и я продолжаю получать ошибки. Это код моего бота:
И когда я запускаю его, возникает такая ошибка:
Я действительно не знаю, что делать, все, что я сделал, это следующие команды в CMD:
Все это, я убедился, что модули установлены без ошибок, и они это сделали, все и так, и я знаю, что вам нужны другие "программы", и я установил следующие программы: Python 3.6.3 64x и Python 3.7.0a2 64x
Мой компьютер от 64-битной архитектуры, поэтому он полностью соответствует.
Вполне возможно, что pip устанавливает модуль из чужой директории в версию Python, с которой вы запускаете ваш скрипт. Попробуйте указать версию python, добавив номер версии в команду терминала, например, python3.6 -m pip install discord.py . Если это не сработает, попробуйте использовать pip3 вместо pip .
редактирование: также не пытайтесь установить asyncio , это часть стандартной библиотеки.
Чтобы проверить, какой интерпретатор использует PyCharm, выберите «Файл» > «Настройки» > «Проект: имя» > «Интерпретатор проекта». Затем в командной строке CMD запустите where python . Если два пути не совпадают, это ваша проблема.
Зайдите в терминал и используйте: pip uninstall discord.py подождите несколько секунд, чтобы он мог полностью удалить его, а затем используйте pip install discord.py . Должно сработать
Не могли бы вы добавить примеры полных команд, которые нужно ввести? Это облегчило бы использование вашего ответа.
да, намного лучше :) Во втором фрагменте кода есть проблема с обратными кавычками. Использование одиночных обратных кавычек для включения code должно работать.
sudo pip install discord.py решает проблему
Возможно, это проблема версии Python.
Когда я попытался запустить в python3.8, я получил ту же ошибку. Перешел на 3.6 и все заработало.
я хотел бы использовать
вместо установки discord.py. Надеюсь, это сработает!
проверьте местоположение интерпретатора Python в pycharm. Или установите дискорд с помощью команды sudo pip
Я предполагаю, что у вашего venv в pycharm и вашей среде в командной строке установлены разные пакеты. Если ошибка заключается в том, что программа не запускается в командной строке, попробуйте открыть командную строку и запустить pip install discord (pip должен быть в вашем PATH), чтобы установить ее в основной каталог python. Вы заметите, что в PyCharm, если вы откроете вкладку терминала, там написано
с «(venv)» означает, что здесь загружается виртуальная среда, в которую могут быть установлены пакеты без изменения вашей основной установки на вашем ПК (обычно расположенной в C:\Program Files\Python 3.5). Однако для запуска скриптов из командной строки вам потребуется установить пакет в основной каталог python, что pip install discord и будет выполнено.
Arthurdw commented Aug 16, 2018
@ItWasAllIntended The suggested version is 3.4 and 3.5.
ghost commented May 11, 2017
Sorry to necro this, but I'm getting the same issue. When I run python3 , then import discord , I get no errors (or text in my cmd window), but I definitely don't have any directories named discord in there. Some of my package names include the string "discord", but none are just the word so it shouldn't have an issue, right?
ModuleNotFoundError на Python | Исправлено EasyComputerUse
Пытаюсь запустить свой файл .py из CMD, но не может найти модуль Discord
Хотя, когда бегаю:
Работает как задумано, есть предложения?
Зайдите в терминал и используйте: pip uninstall discord.py подождите несколько секунд, чтобы он мог полностью удалить его, а затем используйте pip install discord.py . Должно сработать
- 1 Не могли бы вы добавить примеры полных команд, которые нужно вводить? Это упростит использование ответа.
- Как этот @Joooeey?
- да, намного лучше 🙂 Проблема с обратными кавычками во втором фрагменте кода. Использование одинарных обратных кавычек для заключения code должно сработать.
проверьте расположение интерпретатора python в pycharm. Или установите Discord с помощью команды sudo pip
sudo pip install discord.py решает проблему
Я предполагаю, что ваш venv в pycharm и ваша среда в командной строке имеют разные пакеты. Если ошибка заключается в том, что программа не работает в командной строке, попробуйте открыть командную строку и запустить pip install discord (pip должен быть в вашем PATH), чтобы установить его в ваш основной каталог python. Вы заметите, что в PyCharm, если вы откроете вкладку терминала, он говорит
"(venv)" означает, что здесь загружается виртуальная среда, в которую могут быть установлены пакеты без изменения вашей основной установки на вашем ПК (обычно находится в C: \ Program Files \ Python 3.5). Однако для запуска сценариев из командной строки вам потребуется установить пакет в основной каталог python, который pip install discord выполню.
Я пытаюсь запустить неработающий файл в python 3.8.2. Постоянно появляется ошибка с надписью "Нет модуля с именем ‘discord’". Я пытаюсь создать бота discord, но IDLE, похоже, не может найти модуль под названием discord. Он продолжает выделять оператор import discord в строке 1.
1 ответ
Я думаю, что вы не установили модуль discord. Пожалуйста, установите его с помощью "pip install discord"
Похожие вопросы:
Я пытаюсь импортировать ‘sklearn’, используя Python 3.4.3 на Raspberry Pi 3 под управлением Raspian. Я скачал microconda3, который включает в себя все необходимые модули для использования scikit.
Сейчас я использую aws-glue и хотел бы подключить aws-glue к aws-aurora(Postgres)! Итак, я создал задание aws-glew для подключения aws-glue к aws-aurora(Postgres) с помощью pg8000. Но я получаю.
sethwheway commented Aug 16, 2018
@Arthurdw Why would you install 3.5? 3.6.6 is the latest version that works with dpy
Читайте также: