ImportError: cannot import name 'Message' from partially initialized module 'pyrogram.types' can not import it
ImportError: cannot import name 'Message' from partially initialized module 'pyrogram.types' can not import it
我在程序中使用热解图,但是当我 运行 程序时出现导入错误
我卸载并重新安装它,但问题仍然存在。
我无法修复它,我已经尝试过以前的版本和新版本,但问题是一样的。
这是输出:
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrogram
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/__init__.py", line 40, in <module>
from . import raw, types, filters, handlers, emoji
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py", line 22, in <module>
from .input_media import *
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/__init__.py", line 25, in <module>
from .input_phone_contact import InputPhoneContact
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/input_phone_contact.py", line 20, in <module>
from pyrogram.session.internals import MsgId
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/__init__.py", line 19, in <module>
from .auth import Auth
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/auth.py", line 29, in <module>
from pyrogram.crypto import aes, rsa, prime
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/crypto/prime.py", line 19, in <module>
from random import randint
File "/home/ak/Desktop/development/bots/pyrogramplugins/multiuserbot/final/random.py", line 1, in <module>
from pyrogram import Client, filters, idle
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/filters.py", line 24, in <module>
from pyrogram.types import Message, CallbackQuery, InlineQuery, InlineKeyboardMarkup, ReplyKeyboardMarkup, Update
ImportError: cannot import name 'Message' from partially initialized module 'pyrogram.types' (most likely due to a circular import) (/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py)
>>>
我被困在这里我已经尝试了我所知道的一切但无法修复它
这是因为文件名与我在代码中使用的模块名相同。
更改文件名并且永远不要给文件一个模块名称
我在程序中使用热解图,但是当我 运行 程序时出现导入错误 我卸载并重新安装它,但问题仍然存在。 我无法修复它,我已经尝试过以前的版本和新版本,但问题是一样的。 这是输出:
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrogram
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/__init__.py", line 40, in <module>
from . import raw, types, filters, handlers, emoji
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py", line 22, in <module>
from .input_media import *
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/__init__.py", line 25, in <module>
from .input_phone_contact import InputPhoneContact
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/input_phone_contact.py", line 20, in <module>
from pyrogram.session.internals import MsgId
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/__init__.py", line 19, in <module>
from .auth import Auth
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/auth.py", line 29, in <module>
from pyrogram.crypto import aes, rsa, prime
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/crypto/prime.py", line 19, in <module>
from random import randint
File "/home/ak/Desktop/development/bots/pyrogramplugins/multiuserbot/final/random.py", line 1, in <module>
from pyrogram import Client, filters, idle
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/filters.py", line 24, in <module>
from pyrogram.types import Message, CallbackQuery, InlineQuery, InlineKeyboardMarkup, ReplyKeyboardMarkup, Update
ImportError: cannot import name 'Message' from partially initialized module 'pyrogram.types' (most likely due to a circular import) (/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py)
>>>
我被困在这里我已经尝试了我所知道的一切但无法修复它
这是因为文件名与我在代码中使用的模块名相同。 更改文件名并且永远不要给文件一个模块名称