尝试调用pyplot.show时,出现以下错误消息。
import time
from telegram import MessageEntity,Bot
from telegram.ext import Updater,CommandHandler,MessageHandler,Filters,ConversationHandler
from telegram import KeyboardButton,ReplyKeyboardMarkup,ReplyKeyboardRemove
updater = Updater(token=token,use_context=True)
dispatcher = updater.dispatcher
def start(update,context):
username = update.message.from_user.first_name
context.bot.send_message(chat_id=update.effective_chat.id,text=f"Hello {username},Welcome to my bot!")
context.bot.send_message(chat_id=update.effective_chat.id,text='May i know your phone no ?')
def reply_with_number(update,context):
if update.message.text and len(update.message.text) <= 13:
try:
if update.message.text[0:3] == '+91':
phone_number = int(update.message.text[3:])
elif update.message.text[0:2] == '91':
phone_number = int(update.message.text[2:])
elif update.message.text[0] == '0':
phone_number = int(update.message.text[1:])
else:
phone_number = int(update.message.text)
context.bot.send_message(chat_id=update.effective_chat.id,text='Looks good!',reply_markup=reply_markup)
except Exception as e:
update.message.reply_text('Please enter phone number not strings!')
def ask_link(update,context):
link = update.message.text
neat_url = strip(link)
if neat_url != None:
context.bot.send_message(chat_id=update.effective_chat.id,text='Link looks good')
elif neat_url == None:
context.bot.send_message(chat_id=update.effective_chat.id,text='Its invalid!')
start_handler = CommandHandler('start',start)
dispatcher.add_handler(start_handler)
reply_handler = MessageHandler(Filters.contact | Filters.text,reply_with_number)
dispatcher.add_handler(reply_handler)
ask_for_link = MessageHandler(Filters.text,ask_link)
dispatcher.add_handler(ask_for_link)
updater.start_polling()
寻找答案,尽管它与https://www.reddit.com/r/archlinux/comments/d6h3kl/python_qt_cant_import_matplotlibpyplot/是相同的问题,但我只是重新安装了很多软件包(并且几乎破坏了整个系统),并且我遇到了相同的错误。
而且,matplotlib.pyplot.show()和opencv.imshow()单独工作时也可以正常工作,但是当我使用opencv进行某些处理时,我想在pyplot.show()中显示错误之处出来。
我不知道如何调试Qt,就像u / tim-hilt在他的帖子中所做的一样,所以这是我目前可以提供的所有信息。我想出了办法。
预先感谢我可以得到的任何答复。