当前位置: 首页 > news >正文

Mac 安装psycopg2出错:Error:pg_config executable not found的解决

在mac 上执行pip3 install psycopg2-binary出现如下错误:

Error:pg_config executable not found

然后我又到终端里执行

brew install  postgresql@16 

显示

Warning: You are using macOS 15.
We do not provide support for this pre-release version.
It is expected behaviour that some formulae will fail to build in this pre-release version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

以为是安装的psycopg2 版本问题,试了安装15、16都出现以上警告。

解决办法:

1、更新brew版本

brew update

2、然后再安装postgresql@16

brew install postgresql@16

postgresql安装成功

3、添加路径

vim ~/.bash_profile
export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/postgresql@16/lib"
export CPPFLAGS="-I/opt/homebrew/opt/postgresql@16/include"

保存后退出,
再执行

source ~/.bash_profile

4、安装psycopg2-binary

到IDE中,执行

pip3 install psycopg2-binary

完美安装成功!

http://www.lryc.cn/news/516522.html

相关文章:

  • 【vue3封装element-plus的反馈组件el-drawer、el-dialog】
  • LeetCode:2274. 不含特殊楼层的最大连续楼层数(排序 Java)
  • 生成树之STP
  • 音视频入门基础:MPEG2-PS专题(6)——FFmpeg源码中,获取PS流的视频信息的实现
  • 深入解析HDFS:定义、架构、原理、应用场景及常用命令
  • Rust:运行调用 Lua 脚本
  • PHP语言的数据库编程
  • Formality:参数化设计的命名规则
  • xss-labs关卡记录8-14
  • SPSS实现中介效应与调节效应
  • 计算机的错误计算(二百零三)
  • 【计算机网络】什么是AC和AP?
  • python3中函数的参数
  • 数据仓库建设方案和经验总结
  • Re77 读论文:LoRA: Low-Rank Adaptation of Large Language Models
  • 曲波系数 curvelet transform
  • OS的随机数生成过程中的内核熵池
  • 数据结构:双向循环链表
  • IP网和传输网区别(以访问百度为例!)
  • STM32裸机开发转FreeRTOS教程
  • FreeSWITCH dialplan/default.xml 之释疑
  • lambda用法及其原理
  • Go Ebiten随机迷宫生成示例
  • 前端学习DAY31(子元素溢出父元素)
  • 『SQLite』表的创建、修改和删除
  • 可持久化数据结构-线段树(主席树)
  • 如何利用PHP爬虫按关键字搜索淘宝商品
  • GitHub - riscv-software-src/riscv-isa-sim: Spike, a RISC-V ISA Simulator
  • ubuntu开机启动服务
  • 电子电气架构 --- 设计车载充电机的关键考虑因素