【教程】Python虚拟环境安装Open-WebUI

AI摘要

Python虚拟环境可隔离依赖,避免运行异常。创建激活环境后安装Open WebUI,通过pip更新并配置systemd服务实现开机自启。

Python虚拟环境优点:不会受其他服务依赖安装影响,避免open-webui 运行异常;

1、创建虚拟环境

python3 -m venv venv

2、激活虚拟环境

source venv/bin/activate

3、安装Open WebUI

open-webui serve

4、虚拟环境更新Open WebUI

在Open WebUI 虚拟环境里使用下面的命令行进行更新

pip install -U open-webui

5、设置开机启动

在/etc/systemd/system/目录下面创建openwebui.service文件

填入下面的配置

[Unit]
Description=Open-webui Service
Before=network.target

[Service]
Type=simple
User=root
Group=root
Restart=always
RestartSec=3
WorkingDirectory=/path/open-webui
ExecStartPre=/usr/bin/python3 -m venv venv
Environment=PATH=/usr/bin:/usr/local/bin

EnvironmentFile=/path/open-webui.env
ExecStart=/bin/bash -c 'source venv/bin/activate && open-webui serve --port 8080'

[Install]
WantedBy=multi-user.target

启动open webui 服务

systemctl daemon-reload
systemctl start openwebui

Saiyintai

软件测试工程师

相关推荐

暂无评论