使用root账户运行下面的pip部分,其他部分则不需要root账户。
pip install nb-cli
pip install nonebot-adapter-onebot安装go-cqhttp,去github下载对应版本。修改其中的config.yml
universal: ws://your_websocket_universal.server改为
universal: ws://127.0.0.1:8080/onebot/v11/ws即本地8080端口,onebotv11
screen -S cqhttp
./go-cqhttp #启动,之后扫码登陆,然后ctrl+a+d离开在要建立nonebot2的文件夹上级例如想要安装在ubuntu/chatgpt/文件夹,则是进入ubuntu文件夹
screen -S bot
nb create #建立机器人
nb run #运行机器人ctrl+c关闭机器人,安装chatgpt插件
nb plugin install nonebot-plugin-chatgpt配置.env.prod中的相关项。
再次运行后发现缺少playwright,再次ctrl+c关闭。
Nonebot2默认使用virtualenv虚拟环境
直接输入:venv\Scripts\activate激活虚拟环境
ubuntu可以输入source .venv\bin\activate激活虚拟环境
想要使用低版本环境可以用virtualenv venv –python=pythonx.x.x(未测试)
退出虚拟环境:deactivate
在windows中可能会遇到DLL load failed while importing _greenlet
在windows中(不是虚拟环境)安装pip3 install msvc-runtime