Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用消息处理程序(telebot)时出错_Python_Telegram_Py Telegram Bot Api - Fatal编程技术网

Python 使用消息处理程序(telebot)时出错

Python 使用消息处理程序(telebot)时出错,python,telegram,py-telegram-bot-api,Python,Telegram,Py Telegram Bot Api,我尝试使用pyTelegramBotAPI,telebot创建自己的电报机器人。这是我的密码: import telebot bot = telebot.TeleBot("xxxx") @bot.message_handler(commands=['start', 'help']) def send_welcome(message): bot.reply_to(message, "Howdy, how are you doing?") bot

我尝试使用pyTelegramBotAPI,telebot创建自己的电报机器人。这是我的密码:

import telebot

bot = telebot.TeleBot("xxxx")

@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
    bot.reply_to(message, "Howdy, how are you doing?")

bot.polling()
但是,当我运行它时,会出现错误:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import telebot
  File "/home/rm_coder/.local/lib/python3.8/site-packages/telebot/__init__.py", line 816
    @util.async()
          ^
SyntaxError: invalid syntax
回溯(最近一次呼叫最后一次):
文件“main.py”,第1行,在
进口遥控机器人
文件“/home/rm\u coder/.local/lib/python3.8/site packages/telebot/\uuuuu init\uuuuuu.py”,第816行
@util.async()
^
SyntaxError:无效语法

您是如何运行bot的?你确定你使用的是3.6+?