Comments (16)
Во-первых, не нужно открывать новые issue, если речь идёт о старых. В закрытые issue можно комментировать.
Во-вторых, Вы бы всё-таки удосужились прочитать то, что скинули. Питон пишет, что библиотека уже установлена и этот текст НЕ является сообщением об ошибке.
from telegram-tutorial.
Думалось не придется так детализировать.
НО придется
взял ваш листинг
-- 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.
Вопрос на засыпку: какой интерпретатор Python выполняет Ваш код?
from telegram-tutorial.
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.
У меня есть большое подозрение, что либо не тот интерпретатор используется, либо остались хвосты от telebot. Проще перезагрузиться и попробовать ещё раз сделать импорт, иногда помогает.
from telegram-tutorial.
до прошлого воскресенья у меня было 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.
в общем не помогло (((
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.
Стоп. Вы запускаете скрипт в виртуальном окружении (venv), а библиотеку ставите в глобальное. Либо не используйте venv, либо ставьте библиотеку внутри него
from telegram-tutorial.
заработало, досадная ошибка действительно, благодарю за внимание к моим вопросам
from telegram-tutorial.
У меня же ошибка на счёт 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.
Стоп. Вы запускаете скрипт в виртуальном окружении (venv), а библиотеку ставите в глобальное. Либо не используйте venv, либо ставьте библиотеку внутри него
как ставить библиотеку внурти его?
from telegram-tutorial.
mkdir botdir
cd botdir
python3 -m venv venv
source venv/bin/activate
pip install pytelegrambotapi
from telegram-tutorial.
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.
telebot.TeleBot
Читайте документацию!
from telegram-tutorial.
@75VK
Отформатируйте, пожалуйста, код. Читать невозможно
Upd: извините, но с наркобарыгами дел не имею.
from telegram-tutorial.
@75VK
Отформатируйте, пожалуйста, код. Читать невозможноUpd: извините, но с наркобарыгами дел не имею.
Код не мой так-то,мне просто надо понять,что в нём не так,я своего бота по этому образцу буду писать
from telegram-tutorial.
Related Issues (20)
- Сделать OpenGraph-теги для каждой страницы учебника
- Блокировка t.me ссылок HOT 1
- Сделать что-то с SQLighter HOT 1
- Как понять какой модуль aiogram в каком файле бота нужно импортировать? HOT 4
- Тотальная переделка учебника HOT 1
- Ошибка при запуске HOT 5
- Эхо бот не работает HOT 1
- File "./zbxTelegram.py", line 11, in <module>
- def start_message(message): TypeError: 'NoneType' object is not callable HOT 14
- AttributeError: 'TeleBot' object has no attribute 'message_handler'
- Ошибка HOT 2
- Ошибка запуска HOT 2
- NameError: name 'Telebot' is not defined. Did you mean: 'TeleBot'? HOT 6
- Бот и телефон HOT 1
- @era1sed а что `pip freeze` показывает всё-таки? HOT 1
- ошибка телеграм бота HOT 1
- NameError HOT 3
- Error Telebot HOT 1
- callback_data HOT 4
- NameError: name 'bot' is not defined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegram-tutorial.