Telebot程序包导入“类型”问题

时间:2018-09-25 13:37:05

标签: python wxpython telegram telegram-bot python-telegram-bot

当我想在pycharm中运行我的机器人时,出现此错误:

\Desktop\st\taxi\taxi.py", line 5, in <module>
    from telebot import types
ImportError: cannot import name 'types' from 'telebot' (C:\Users\User\Desktop\st\taxi\venv\lib\site-packages\telebot\__init__.py)

这是我的代码:

import config
from telebot import TeleBot, types

bot = TeleBot(config.TELEGRAM_BOT_TOKEN)

@bot.message_handler(commands=['location']) #Запрос локации
def request_location(message):
    keyboard = types.ReplyKeyboardMarkup(row_width=1,      resize_keyboard=True)

    button_geo = types.KeyboardButton(text="Отправить местоположение", request_l
ocation=True)
    keyboard.add(button_geo)
    bot.send_message(message.chat.id, "Поделись местоположением", reply_markup=k
eyboard)

if __name__ == "__main__":
    bot.polling()

该如何解决?

0 个答案:

没有答案