Python 导入错误:无法导入名称';Bot&x27;从部分初始化的模块';电报';

Python 导入错误:无法导入名称';Bot&x27;从部分初始化的模块';电报';,python,telegram,telegram-bot,Python,Telegram,Telegram Bot,每当我在cmd中使用命令pip install telegram bot时,就会出现此错误: 原因-错误库 pip安装电报bot 遥控机器人 如果你想使用Telebot,你应该安装pyTelegramBotAPI A图 此外,我建议尝试使用现代流行的框架:aiogram原因-错误库 pip安装电报bot 遥控机器人 如果你想使用Telebot,你应该安装pyTelegramBotAPI A图 另外,我建议尝试使用现代流行的框架:aiogram尝试pip安装python电报bot尝试pip安装py

每当我在cmd中使用命令pip install telegram bot时,就会出现此错误:

原因-错误库
pip安装电报bot

遥控机器人 如果你想使用Telebot,你应该安装
pyTelegramBotAPI

A图 此外,我建议尝试使用现代流行的框架:
aiogram

原因-错误库
pip安装电报bot

遥控机器人 如果你想使用Telebot,你应该安装
pyTelegramBotAPI

A图
另外,我建议尝试使用现代流行的框架:
aiogram
尝试
pip安装python电报bot
尝试
pip安装python电报bot

感谢您的回答,并对延迟表示抱歉。安装PyBotapi并没有解决我的问题。我正在使用Heroku,它会自动导入电报机器人,我不知道为什么。我什么都试过了,但都没用。您是否建议我重写代码并尝试您的框架?我被卡住了。不熟悉Heroku,但我认为它只是从您的requirements.txt文件安装libs。我还建议迁移到Aigram,它不是火箭科学:)谢谢你的回答,很抱歉耽搁了。安装PyBotapi并没有解决我的问题。我正在使用Heroku,它会自动导入电报机器人,我不知道为什么。我什么都试过了,但都没用。您是否建议我重写代码并尝试您的框架?我被卡住了。不熟悉Heroku,但我认为它只是从您的requirements.txt文件安装libs。我还建议迁移到Aigram,它不是火箭科学:)
    C:\Windows\system32>pip install telegram-bot
Collecting telegram-bot
Using cached telegram-bot-0.1.tar.gz (51 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\miclo\\AppData\\Local\\Temp\\pip-install-j1l7uwqx\\telegram-bot_a7d2b1d51c264e718c85210726554603\\setup.py'"'"'; __file__='"'"'C:\\Users\\miclo\\AppData\\Local\\Temp\\pip-install-j1l7uwqx\\telegram-bot_a7d2b1d51c264e718c85210726554603\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\miclo\AppData\Local\Temp\pip-pip-egg-info-4qf8pb7l'
         cwd: C:\Users\miclo\AppData\Local\Temp\pip-install-j1l7uwqx\telegram-bot_a7d2b1d51c264e718c85210726554603\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\miclo\AppData\Local\Temp\pip-install-j1l7uwqx\telegram-bot_a7d2b1d51c264e718c85210726554603\setup.py", line 12, in <module>
        import telegram
      File "C:\Users\miclo\AppData\Local\Temp\pip-install-j1l7uwqx\telegram-bot_a7d2b1d51c264e718c85210726554603\telegram\__init__.py", line 15, in <module>
        from telegram import Bot, ChatActions
    ImportError: cannot import name 'Bot' from partially initialized module 'telegram' (most likely due to a circular import) (C:\Users\miclo\AppData\Local\Temp\pip-install-j1l7uwqx\telegram-bot_a7d2b1d51c264e718c85210726554603\telegram\__init__.py)
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Collecting telegram-bot
  Using cached telegram-bot-0.1.tar.gz (51 kB)

DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated and has no effect anymore. pip 21.1 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
    ERROR: Command errored out with exit status 1:
     command: 'D:\Development\telegram\venv\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\miclo\\AppData\\Local\\Temp\\pip-install-60osryel\\telegram-bot_02585524af70443f98a2a69b3da7ae38\\setup.py'"'"'; __file__='"'"'C:\\Users\\miclo\\AppData\\Local\\Temp\\pip-install-60osryel\\telegram-bot_02585524af70443f98a2a69b3da7ae38\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\miclo\AppData\Local\Temp\pip-pip-egg-info-0ihid_ld'
         cwd: C:\Users\miclo\AppData\Local\Temp\pip-install-60osryel\telegram-bot_02585524af70443f98a2a69b3da7ae38\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\miclo\AppData\Local\Temp\pip-install-60osryel\telegram-bot_02585524af70443f98a2a69b3da7ae38\setup.py", line 12, in <module>
        import telegram
      File "C:\Users\miclo\AppData\Local\Temp\pip-install-60osryel\telegram-bot_02585524af70443f98a2a69b3da7ae38\telegram\__init__.py", line 15, in <module>
        from telegram import Bot, ChatActions
    ImportError: cannot import name 'Bot' from partially initialized module 'telegram' (most likely due to a circular import) (C:\Users\miclo\AppData\Local\Temp\pip-install-60osryel\telegram-bot_02585524af70443f98a2a69b3da7ae38\telegram\__init__.py)
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
2020-12-04T20:24:35.852594+00:00 app[web.1]: File "main.py", line 5, in <module>
2020-12-04T20:24:35.852826+00:00 app[web.1]: from telegram.ext import CommandHandler, MessageHandler, Filters, Updater
2020-12-04T20:24:35.852831+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/__init__.py", line 21, in <module>
2020-12-04T20:24:35.853028+00:00 app[web.1]: from .basepersistence import BasePersistence
2020-12-04T20:24:35.853033+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/basepersistence.py", line 25, in <module>
2020-12-04T20:24:35.853242+00:00 app[web.1]: from telegram import Bot
2020-12-04T20:24:35.853243+00:00 app[web.1]: ImportError: cannot import name 'Bot'
import os
import telebot
import xlrd
from flask import Flask, request
from telegram.ext import CommandHandler, MessageHandler, Filters, Updater