Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'telebot' #13

Closed
drno-reg opened this issue Mar 28, 2018 · 16 comments
Closed

ModuleNotFoundError: No module named 'telebot' #13

drno-reg opened this issue Mar 28, 2018 · 16 comments

Comments

@drno-reg
Copy link

Лучше не стало после установки пакета

pip install pytelegrambotapi

c:\python36\scripts\pip install pytelegrambotapi
Requirement already satisfied: pytelegrambotapi in c:\python36\lib\site-packages
Requirement already satisfied: requests in c:\python36\lib\site-packages (from pytelegrambotapi)
Requirement already satisfied: six in c:\python36\lib\site-packages (from pytelegrambotapi)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: certifi>=2017.4.17 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: idna<2.7,>=2.5 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)

@MasterGroosha
Copy link
Owner

Во-первых, не нужно открывать новые issue, если речь идёт о старых. В закрытые issue можно комментировать.

Во-вторых, Вы бы всё-таки удосужились прочитать то, что скинули. Питон пишет, что библиотека уже установлена и этот текст НЕ является сообщением об ошибке.

@drno-reg
Copy link
Author

Думалось не придется так детализировать.
НО придется

взял ваш листинг

-- coding: utf-8 --

import telebot
import config

bot = telebot.TeleBot(config.token)

@bot.message_handler(content_types=["text"])
def repeat_all_messages(message): # Название функции не играет никакой роли, важно не повторяться
bot.send_message(message.chat.id, message.text)

if name == "main":
bot.polling(none_stop=True)

установил пакет pip install pytelegrambotapi
он установился успешно

c:\python36\scripts\pip install pytelegrambotapi
Requirement already satisfied: pytelegrambotapi in c:\python36\lib\site-packages
Requirement already satisfied: requests in c:\python36\lib\site-packages (from pytelegrambotapi)
Requirement already satisfied: six in c:\python36\lib\site-packages (from pytelegrambotapi)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: certifi>=2017.4.17 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: idna<2.7,>=2.5 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)

запускаю код возвращается ошибка:

Traceback (most recent call last):
File "C:/Server/Repositories/um_open/templates/Test/TelegramBot1.py", line 3, in
import telebot
ModuleNotFoundError: No module named 'telebot'

Как решить эту проблему?

@MasterGroosha
Copy link
Owner

Вопрос на засыпку: какой интерпретатор Python выполняет Ваш код?

@drno-reg
Copy link
Author

Python 3.6.5rc1 (v3.6.5rc1:f03c5148cf, Mar 14 2018, 03:12:11) [MSC v.1913 64 bit (AMD64)] on win32

@MasterGroosha
Copy link
Owner

У меня есть большое подозрение, что либо не тот интерпретатор используется, либо остались хвосты от telebot. Проще перезагрузиться и попробовать ещё раз сделать импорт, иногда помогает.

@drno-reg
Copy link
Author

до прошлого воскресенья у меня было 3 интерпретатора: 2.7, 3.6 и 3.7. Сейчас точно один. Представлю доказательства удаления и новой инсталляции

C:\Windows\system32>pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
aiohttp (3.1.1)
async-timeout (2.0.1)
attrs (17.4.0)
certifi (2018.1.18)
chardet (3.0.4)
future (0.16.0)
get (0.0.39)
idna (2.6)
idna-ssl (1.0.1)
multidict (4.1.0)
pip (9.0.3)
post (0.0.26)
public (0.0.65)
query-string (0.0.28)
request (0.0.26)
requests (2.18.4)
setuptools (28.8.0)
six (1.11.0)
telepot (12.6)
urllib3 (1.22)
yarl (1.1.1)

C:\Windows\system32>pip install pytelegrambotapi
Collecting pytelegrambotapi
Using cached pyTelegramBotAPI-3.6.2.tar.gz
Requirement already satisfied: requests in c:\python36\lib\site-packages (from pytelegrambotapi)
Requirement already satisfied: six in c:\python36\lib\site-packages (from pytelegrambotapi)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: certifi>=2017.4.17 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Requirement already satisfied: idna<2.7,>=2.5 in c:\python36\lib\site-packages (from requests->pytelegrambotapi)
Installing collected packages: pytelegrambotapi
Running setup.py install for pytelegrambotapi ... done
Successfully installed pytelegrambotapi-3.6.2

C:\Windows\system32>pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
aiohttp (3.1.1)
async-timeout (2.0.1)
attrs (17.4.0)
certifi (2018.1.18)
chardet (3.0.4)
future (0.16.0)
get (0.0.39)
idna (2.6)
idna-ssl (1.0.1)
multidict (4.1.0)
pip (9.0.3)
post (0.0.26)
public (0.0.65)
pyTelegramBotAPI (3.6.2)
query-string (0.0.28)
request (0.0.26)
requests (2.18.4)
setuptools (28.8.0)
six (1.11.0)
telepot (12.6)
urllib3 (1.22)
yarl (1.1.1)

@drno-reg
Copy link
Author

в общем не помогло (((

C:\Server\Repositories\um_open\venv\Scripts\python.exe C:/Server/Repositories/um_open/templates/Test/TelegramBot1.py
Traceback (most recent call last):
File "C:/Server/Repositories/um_open/templates/Test/TelegramBot1.py", line 3, in
import telebot
ModuleNotFoundError: No module named 'telebot'

@MasterGroosha
Copy link
Owner

Стоп. Вы запускаете скрипт в виртуальном окружении (venv), а библиотеку ставите в глобальное. Либо не используйте venv, либо ставьте библиотеку внутри него

@drno-reg
Copy link
Author

заработало, досадная ошибка действительно, благодарю за внимание к моим вопросам

@Podvom
Copy link

Podvom commented Feb 14, 2019

У меня же ошибка на счёт pyTelegramBotAPI,
$ git push heroku master
Enumerating objects: 12, done.
Counting objects: 100% (12/12), done.
Delta compression using up to 6 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (12/12), 1.13 KiB | 385.00 KiB/s, done.
Total 12 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.8
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting pyTelegramBorAPI (from -r /tmp/build_1bd91cc91b83923385692023dce257eb/requirements.txt (line 1))
remote: Could not find a version that satisfies the requirement pyTelegramBorAPI (from -r /tmp/build_1bd91cc91b83923385692023dce257eb/requirements.txt (line 1)) (from versions: )
remote: No matching distribution found for pyTelegramBorAPI (from -r /tmp/build_1bd91cc91b83923385692023dce257eb/requirements.txt (line 1))
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to bot-lowxp.
remote:
To https://git.heroku.com/bot-lowxp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/bot-lowxp.git'

Вот что пишет

@jenjajenjaBot
Copy link

Стоп. Вы запускаете скрипт в виртуальном окружении (venv), а библиотеку ставите в глобальное. Либо не используйте venv, либо ставьте библиотеку внутри него

как ставить библиотеку внурти его?

@MasterGroosha
Copy link
Owner

mkdir botdir
cd botdir
python3 -m venv venv
source venv/bin/activate
pip install pytelegrambotapi

@jenjajenjaBot
Copy link

mkdir botdir
cd botdir
python3 -m venv venv
source venv/bin/activate
pip install pytelegrambotapi

bot = telebot.Telebot('MY_TOKEN')
AttributeError: module 'telebot' has no attribute 'Telebot'

@MasterGroosha
Copy link
Owner

telebot.TeleBot

Читайте документацию!

@MasterGroosha
Copy link
Owner

MasterGroosha commented Jan 17, 2020

@75VK
Отформатируйте, пожалуйста, код. Читать невозможно

Upd: извините, но с наркобарыгами дел не имею.

Repository owner deleted a comment from 75VK Jan 17, 2020
@75VK
Copy link

75VK commented Jan 17, 2020

@75VK
Отформатируйте, пожалуйста, код. Читать невозможно

Upd: извините, но с наркобарыгами дел не имею.

Код не мой так-то,мне просто надо понять,что в нём не так,я своего бота по этому образцу буду писать

Repository owner deleted a comment from Shiftersky May 11, 2020
Repository owner locked as resolved and limited conversation to collaborators May 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants