Giter Site home page Giter Site logo

Comments (16)

MasterGroosha avatar MasterGroosha commented on July 27, 2024

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

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

from telegram-tutorial.

drno-reg avatar drno-reg commented on July 27, 2024

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

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

-- 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'

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

from telegram-tutorial.

MasterGroosha avatar MasterGroosha commented on July 27, 2024

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

from telegram-tutorial.

drno-reg avatar drno-reg commented on July 27, 2024

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

from telegram-tutorial.

MasterGroosha avatar MasterGroosha commented on July 27, 2024

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

from telegram-tutorial.

drno-reg avatar drno-reg commented on July 27, 2024

до прошлого воскресенья у меня было 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)

from telegram-tutorial.

drno-reg avatar drno-reg commented on July 27, 2024

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

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'

from telegram-tutorial.

MasterGroosha avatar MasterGroosha commented on July 27, 2024

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

from telegram-tutorial.

drno-reg avatar drno-reg commented on July 27, 2024

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

from telegram-tutorial.

Podvom avatar Podvom commented on July 27, 2024

У меня же ошибка на счёт 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'

Вот что пишет

from telegram-tutorial.

jenjajenjaBot avatar jenjajenjaBot commented on July 27, 2024

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

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

from telegram-tutorial.

MasterGroosha avatar MasterGroosha commented on July 27, 2024

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

from telegram-tutorial.

jenjajenjaBot avatar jenjajenjaBot commented on July 27, 2024

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'

from telegram-tutorial.

MasterGroosha avatar MasterGroosha commented on July 27, 2024

telebot.TeleBot

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

from telegram-tutorial.

MasterGroosha avatar MasterGroosha commented on July 27, 2024

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

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

from telegram-tutorial.

75VK avatar 75VK commented on July 27, 2024

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

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

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

from telegram-tutorial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.