python pip3 安装psycopg2报错

root@edb \~\]$ pip3 install psycopg2 Defaulting to user installation because normal site-packages is not writeable Collecting psycopg2 Using cached psycopg2-2.9.3.tar.gz (380 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─\> \[1 lines of output

ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.

end of output

note: This error originates from a subprocess, and is likely not a problem with pip.

error: metadata-generation-failed

× Encountered error while generating package metadata.

╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

hint: See above for details.

安装其它包都可以,只有在安装psycopg2的时候报错,但是pip3 install psycopg2 在其它机器是没有问题的,就说明语句没有错误,报错截图忘记保存了,大概的意思就是不是pip的问题,是包的问题。

原因:

这台安装不上的机器,已经安装了PG数据库,可能是因为这个对psycopg2的包造成了影响,需要换个包安装:psycopg2-binary,这个包安装上,测试psycopg2也是正常的

复制代码
[root@localhost ~]# pip3 install psycopg2-binary
Collecting psycopg2-binary
  Obtaining dependency information for psycopg2-binary from https://files.pythonhosted.org/packages/bc/0d/486e3fa27f39a00168abfcf14a3d8444f437f4b755cc34316da1124f293d/psycopg2_binary-2.9.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Downloading psycopg2_binary-2.9.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.4 kB)
Downloading psycopg2_binary-2.9.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 2.5 MB/s eta 0:00:00
Installing collected packages: psycopg2-binary
Successfully installed psycopg2-binary-2.9.9
[root@localhost ~]# python3
Python 3.10.4 (main, Oct  8 2023, 16:03:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> exit()
相关推荐
feiyangqingyun10 分钟前
Qt项目作品在苹果macos上编译运行效果/视频监控系统/物联网平台等
开发语言·qt·macos
测试老哥20 分钟前
Postman环境变量设置全攻略
自动化测试·软件测试·python·测试工具·职场和发展·接口测试·postman
你不是我我42 分钟前
【Java 开发日记】我们来说一说 Redisson 的原理
java·开发语言
kk”42 分钟前
C++ stack 和 queue
开发语言·c++
Matlab仿真实验室1 小时前
基于Matlab实现双目图计算深度图
开发语言·数码相机·matlab·双目图计算深度图
惜月_treasure1 小时前
Text2SQL与工作流实现:让数据库查询变得轻松又高效
数据库·人工智能·python
QT 小鲜肉1 小时前
【数据结构与算法基础】05. 栈详解(C++ 实战)
开发语言·数据结构·c++·笔记·学习·算法·学习方法
老K的Java兵器库1 小时前
Collections 工具类 15 个常用方法源码:sort、binarySearch、reverse、shuffle、unmodifiableXxx
java·开发语言·哈希算法
武子康1 小时前
Java-153 深入浅出 MongoDB 全面的适用场景分析与选型指南 场景应用指南
java·开发语言·数据库·mongodb·性能优化·系统架构·nosql
码猩2 小时前
获取dm音视频文案
python