error: Distribution `psycopg-binary==3.2.2 can‘t be installed for the current platform

在Mac OS上执行如下命令时,很意外地报错了 

git clone git@github.com:fastapi/full-stack-fastapi-template.git
cd full-stack-fastapi-template/backend
uv sync

 错误内容:

$ uv sync
Using CPython 3.12.5 interpreter at: /usr/local/opt/python@3.12/bin/python3.12
Removed virtual environment at: .venv
Creating virtual environment at: .venv
Resolved 81 packages in 3ms
error: Distribution `psycopg-binary==3.2.2 @ registry+https://mirrors.cloud.tencent.com/pypi/simple/` can't be installed because it doesn't have a source distribution or wheel for the current platform

原因:

当前系统在镜像源里,没有psycopg-binary==3.2.2的安装包

(我电脑比较老,新版的psycopg不支持)

解决:

$ uv pip install "psycopg[binary]"
Resolved 3 packages in 3.26s
Prepared 1 package in 2.71s
Installed 3 packages in 5ms
 + psycopg==3.1.19
 + psycopg-binary==3.1.19
 + typing-extensions==4.12.2

可以看到支持mac11.7的psycopg最高是到3.1.19

于是只需把pyproject.toml中的版本依赖改成<3.1.20即可

-    "psycopg[binary]<4.0.0,>=3.1.13",
+    "psycopg[binary]<3.1.20,>=3.1.13",

然后,再重新执行uv sync即可

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值