nikissXI / nonebot_plugins

58 stars 14 forks source link

安装以后启动不了了,直接挂了 #3

Closed bowen99 closed 1 year ago

bowen99 commented 1 year ago

ImportError: cannot import name 'DotenvType' from 'pydantic.env_settings' (E:\mybots\venv\lib\site-packages\pydantic\env_settings.cp39-win_amd64.pyd)

nikissXI commented 1 year ago

哪个插件?

bowen99 commented 1 year ago

[nonebot_plugin_setu_customization] 会卸载pydantic 有安装权限问题 然后启动的时候提示mportError: cannot import name 'DotenvType' from 'pydantic.env_settings' ,nb命令失效 需要重新安装python才可以

nikissXI commented 1 year ago

还会卸载pydantic?我的pyproject.toml文件里都没提到它

bowen99 commented 1 year ago

Installing collected packages: pytz, python-socks, ujson, tzdata, soupsieve, pydantic, Pillow, uvicorn, starlette, pytz-deprecation-shim, beautifulsoup4, tzlocal, fastapi, nonebot2, httpx-socks, apscheduler, nonebot-plugin -setu-customization Attempting uninstall: pydantic Found existing installation: pydantic 1.10.4 Uninstalling pydantic-1.10.4: Successfully uninstalled pydantic-1.10.4 ERROR: Could not install packages due to an OSError: [WinError 5] 存取被拒。: 'E:\ceshi\venv\Lib\site-packages\~ydantic\annotated_types.cp39-win_amd64.pyd' Check the permissions.

(venv) E:\ceshi>nb Traceback (most recent call last): File "C:\Users\bowen_wang\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\bowen_wang\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "E:\ceshi\venv\Scripts\nb.exe__main__.py", line 4, in File "E:\ceshi\venv\lib\site-packages\nb_cli__init.py", line 6, in from nb_cli.commands.driver import driver File "E:\ceshi\venv\lib\site-packages\nb_cli\commands\driver.py", line 4, in from nb_cli.handlers import search_driver, install_driver, driver_no_subcommand File "E:\ceshi\venv\lib\site-packages\nb_cli\handlers\init.py", line 10, in from .project import create_project File "E:\ceshi\venv\lib\site-packages\nb_cli\handlers\project.py", line 5, in import nonebot File "E:\ceshi\venv\lib\site-packages\nonebot\init__.py", line 46, in from pydantic.env_settings import DotenvType ImportError: cannot import name 'DotenvType' from 'pydantic.env_settings' (E:\ceshi\venv\lib\site-packages\pydantic\env_settings.cp39-win_amd64.pyd)

就是这种情况 纯环境 什么插件都没装的那种 还是会有这种情况

nikissXI commented 1 year ago

你是用什么命令安装的,我复现一下

bowen99 commented 1 year ago

nb plugin install

nikissXI commented 1 year ago

我全局python和虚拟环境python都测试过没问题,都是新建bot测试的,python版本3.10 不过有一个依赖没加上,jinjia2的包,已经更新了。 你这个pydantic倒是没复现成功。 image

nikissXI commented 1 year ago

我之前忽略了有些特性是3.10才有的,你之前用的3.9,不知道有没有影响,你可以再试试安装,现在已经兼容3.8了