pgvector 向量数据库的安装方式全集
Postgres 简介
将您的向量与您的其余数据一起存储。支持:
精确和近似最近邻搜索
单精度、半精度、二进制和稀疏向量
L2 距离、内积、余弦距离、L1 距离、汉明距离和 Jaccard 距离
任何具有 Postgres 客户端的 语言
另外还有 ACID 兼容性、点及时恢复、JOIN 以及 Postgres 的所有其他 出色功能
Linux 和 Mac
编译并安装扩展(支持 Postgres 13+)
cd /home
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git
cd pgvector
make
make install # may need sudo
Windows
确保已安装 Visual Studio 中的 C++ 支持,然后运行:
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
注意:确切路径将根据您的 Visual Studio 版本和版本而有所不同
然后使用 nmake 构建:
set "PGROOT=C:\Program Files\PostgreSQL\16"
cd %TEMP%
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git
cd pgvector
nmake /F Makefile.win
nmake /F Makefile.win install
Docker
使用以下命令获取 Docker 镜像:
docker pull pgvector/pgvector:pg17
如果出现Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
docker源可以切换到阿里云
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
切记重启docker
手动构建镜像
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git
cd pgvector
docker build --pull --build-arg PG_MAJOR=17 -t myuser/pgvector .
Yum
RPM 软件包可从 PostgreSQL Yum 仓库 获取。请按照您的发行版提供的 安装说明 操作,并运行以下命令:
sudo yum install pgvector_17
APT
Debian 和 Ubuntu 包可从 PostgreSQL APT 仓库 获取
sudo apt install postgresql-17-pgvector