Windows版PostgreSQL 安装 vector 扩展

问题

spring-ai在集成PGVector向量存储的时候会报错如下,那么就需要安装pgsql的vector扩展。

SQL [CREATE EXTENSION IF NOT EXISTS vector]; 错误: 无法打开扩展控制文件 "C:/Program Files/PostgreSQL/9.6/share/extension/vector.control": No such file or directory

根据pgvector的github的md文档显示只有Postgres13+的版本才能安装vector扩展。

vector 扩展安装

下载地址:

https://github.com/pgvector/pgvector/tags

1、下载后解压到任意目录

我这里解压后的根目录为 E:\Program Files\pgvector-0.7.4(编译时在命令行会使用cd进入到这个路径,进行编译安装)

2、在 Windows 上编译需要先下载 Visual Studio

下载地址:Visual Studio: 面向软件开发人员和 Teams 的 IDE 和代码编辑器

启动"VisualStudioSetup.exe"后,这里选择安装"使用C++的桌面开发"。

3、安装完成后,使用管理员模式打开cmd

依次执行以下命令便能够完成安装

bash 复制代码
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

cd E:\Program Files\pgvector-0.7.4

set "PGROOT=C:\Program Files\PostgreSQL\16"

nmake /F Makefile.win
nmake /F Makefile.win install

执行效果如下:

4、最后在数据库连接工具中,选中具体的数据库实例,执行以下命令,就能扩展 vector 类型了

bash 复制代码
CREATE EXTENSION vector;
相关推荐
磊灬泽10 小时前
【日常错误】鼠标无反应
linux·windows
UNbuff_017 小时前
Windows netstat 命令使用说明
windows
您的通讯录好友17 小时前
conda环境导出
linux·windows·conda
子兮曰1 天前
🔥C盘告急!WSL磁盘暴增?三招秒清20GB+空间
前端·windows·docker
IvorySQL1 天前
PostgreSQL 大对象管理指南:pg_largeobject 从原理到实践
postgresql
学历真的很重要1 天前
Claude Code Windows 原生版安装指南
人工智能·windows·后端·语言模型·面试·go
李游Leo1 天前
LaTeX TeX Live 安装与 CTAN 国内镜像配置(Windows / macOS / Linux 全流程)
linux·windows·macos
Jayin_chan1 天前
windows下安装claude code+国产大模型glm4.5接入(无需科学上网)
windows·claude code·glm4.5
cpsvps_net1 天前
Windows远程FX编解码优化
windows
爱睡觉的圈圈1 天前
突破反爬限制:动态IP轮换策略与实现
windows·tcp/ip·microsoft