Windows Powershell安装Deepseek-R1

1.准备环境。安装Pyenv、Pipx、Poetry

安装Pyenv。打开Powershell输入

Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"

更新Pyenv。

&"${env:PYENV_HOME}\install-pyenv-win.ps1"
设置全局python版本
pyenv global 3.12.8
设置当前目录python版本
pyenv local 3.13.1

查找要安装的python版本。当前open-webui版本要求Python <3.13.0a1,>=3.11

pyenv install -l | findstr 3.12.8
pyenv install 3.12.8

安装pipx

python -m pip install  pipx

安装poetry

pipx install poetry
查看配置
poetry config --list
设置虚拟环境安装在项目目录
poetry config virtualenvs.in-project true
由于新版poetry把poetry改为插件poetry-plugin-shell,替代方式
激活虚拟环境(bash)
eval $(poetry env activate)
激活虚拟环境(Powershell)
Invoke-Expression (poetry env activate)

2.安装open-webui

若报错,需要安装Microsoft Visual C++ Build Tools,勾选右边三个

poetry add open-webui

 

 Building wheel for chroma-hnswlib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for chroma-hnswlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'hnswlib' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for chroma-hnswlib
Failed to build chroma-hnswlib
ERROR: Failed to build installable wheels for some pyproject.toml based projects (chroma-hnswlib)

3.安装Ollama

下载ollama

在用户变量和系统变量添加环境变量,设置监听地址及模型下载地址。

拉取deepseek-r1模型

ollama pull deepseek-r1:7b

启动open-webui

open-webui serve

阅读剩余
THE END