Ice9Coffee / HoshinoBot

A qqbot for Princess Connect Re:Dive (and other usage :)
GNU General Public License v3.0
1.41k stars 413 forks source link

ImportError: cannot import name 'Message' from 'nonebot' #182

Closed Eigh18n closed 3 years ago

Eigh18n commented 3 years ago

OS: Windows 10 python version: 3.8.2

已安装依赖,在第7步出现问题

 >py -3.8 run.py
Traceback (most recent call last):
  File "run.py", line 1, in <module>
    import hoshino
  File "G:\QQbot\Hoshino\HoshinoBot\hoshino\__init__.py", line 5, in <module>
    from nonebot import Message, MessageSegment, message_preprocessor
ImportError: cannot import name 'Message' from 'nonebot' (D:\Python18\lib\site-packages\nonebot\__init__.py)

疑似原因:我最早直接装了nonebot2脚手架,不知道是不是新版本的问题,将新版本删去后装回旧版本,仍然出现同样情况。 询问过群大佬,无果。

Ice9Coffee commented 3 years ago

nonebot[scheduler]~=1.6.0 使用py -3.8 -m pip freeze查看nonebot版本,使用py -3.8 -m pip install nonebot[scheduler]~=1.6.0安装正确的版本。 nonebot现在最新的版本应该是1.8.2,虽然未经测试,应当不会有兼容性问题,但与nonebot2不兼容。

Eigh18n commented 3 years ago

使用命令后返回结果有nonebot==1.6.0并且已将nonebot2删除,但是问题始终存在 以下为命令返回

>py -3.8 -m pip freeze
aiocache==0.11.1
aiocqhttp==1.2.5
aiofiles==0.6.0
aiohttp==3.7.4.post0
APScheduler==3.7.0
arrow==1.0.3
astroid==2.4.1
async-timeout==3.0.1
attrs==20.3.0
baidu-aip==2.2.18.0
beautifulsoup4==4.9.3
binaryornot==0.4.4
blinker==1.4
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
colorama==0.4.3
configparser==5.0.2
cookiecutter==1.7.2
cycler==0.10.0
fastapi==0.63.0
Flask==1.1.2
fuzzywuzzy==0.18.0
h11==0.11.0
h2==4.0.0
hpack==4.0.0
httpcore==0.12.3
httprequests==0.3
httpx==0.17.1
Hypercorn==0.11.1
hyperframe==6.0.0
idna==2.10
isort==4.3.21
itsdangerous==1.1.0
jieba==0.42.1
Jinja2==2.11.2
jinja2-time==0.2.0
jmespath==0.10.0
kiwisolver==1.3.1
langid==1.1.6
lazy-object-proxy==1.4.3
loguru==0.5.3
lxml==4.6.3
MarkupSafe==1.1.1
matplotlib==3.4.1
mccabe==0.6.1
multidict==5.1.0
mysql-connector-python==8.0.21
nonebot==1.6.0
nonebot-adapter-cqhttp==2.0.0a11.post2
nonebot-plugin-picsearcher==0.1.3
nonebot-plugin-simdraw==0.1.4
numpy==1.20.2
oauthlib==3.1.0
Pillow==7.2.0
poyo==0.5.0
priority==1.3.0
prompt-toolkit==1.0.14
psutil==5.8.0
pydantic==1.8.1
pyfiglet==0.8.post1
Pygments==2.8.1
pygtrie==2.4.2
PyInquirer==1.0.3
pylint==2.5.2
PyMySQL==0.10.1
pyparsing==2.4.7
python-dateutil==2.8.1
python-dotenv==0.16.0
python-slugify==4.0.1
pytz==2021.1
PyYAML==5.4.1
quart==0.11.5
regex==2021.3.17
requests==2.24.0
requests-cache==0.5.2
requests-oauthlib==1.3.0
requests-toolbelt==0.9.1
rfc3986==1.4.0
six==1.15.0
sniffio==1.1.0
sogou-tr-free==0.0.11
soupsieve==2.0.1
starlette==0.13.6
text-unidecode==1.3
tinydb==4.4.0
toml==0.10.1
tomlkit==0.7.0
TwitterAPI==2.6.9.1
typing-extensions==3.7.4.3
tzlocal==2.1
ujson==4.0.2
urllib3==1.25.10
uvicorn==0.13.4
watchgod==0.7
wcwidth==0.2.5
websocket-client==0.58.0
websockets==8.1
Werkzeug==1.0.1
win32-setctime==1.0.3
wrapt==1.12.1
ws4py==0.5.1
wsproto==1.0.0
yarl==1.6.3
you-get==0.4.1475
zhconv==1.4.1

使用安装命令py -3.8 -m pip install nonebot[scheduler]~=1.6.0后返回内容全为Requirement already satisfied 但是问题仍然存在 是配置问题还是我需要全部删除重新安装?

Eigh18n commented 3 years ago

换了个纯净的环境就没事了,只需要把原本的东西删干净再下就行了。

Cathgao commented 2 years ago

遇到同样问题了,实测不支持1.8以上nonebot,换成1.6可以启动