python-离线安装psycopg2
本文最后更新于 1926 天前,其中的信息可能已经有所发展或是发生改变。

1.安装psycopg2需要安装依赖

本案例的操作系统为linux red hat
在安装python依赖包psycopg之前,你必须需要先安装postgresql数据库的相关组件:
postgresql-devel,postgresql,postgresql-libs这三个组件比较重要。另外,可选组件:postgresql-server
1.安装上述组件之前,可以用命令来查看你的系统现在是否已经安装了相关组件:
[root@dthost27 ~]#  rpm -qa | grep postgresql

没有安装则需要安装如下依赖

  • postgresql-libs
  • postgresql
  • postgresql-devel
2.下载依赖地址:
https://centos.pkgs.org/7/centos-x86_64/postgresql-libs-9.2.24-1.el7_5.x86_64.rpm.html
https://centos.pkgs.org/7/centos-x86_64/postgresql-9.2.24-4.el7_8.x86_64.rpm.html
https://centos.pkgs.org/7/centos-x86_64/postgresql-devel-9.2.24-4.el7_8.x86_64.rpm.html
3.安装依赖
rpm -ivh postgresql-libs-9.2.24-1.el7_5.x86_64.rpm
rpm -ivh postgresql-devel-9.2.24-1.el7_5.x86_64.rpm
rpm -ivh postgresql-9.2.24-1.el7_5.x86_64.rpm

2.安装psycopg2依赖包

在线安装

保证依赖组件存在后,就可以使用pip命令安装了:

[root@dthost27 ~]#  pip install psycopg2-binary

注:这里安装的是binary格式的psycopg2依赖包,其实安装psycopg2也可以,但是有时候执行pip install psycopg2会报错,而安装psycopg2-binary(编译后)则不会

或离线安装
https://pypi.org/project/psycopg2-binary/#files

python setpy.py install
离线安装
下载psycopg2离线包,地址:https://pypi.org/project/psycopg2/#files

下载源码tar包,编译安装
步骤如下:
tar -zxvf psycopg2-2.8.4.tar.gz
cd psycopg2-2.8.4
python setup.py build
python setpy.py install
启动python测试
import psycopg2

评论

  1. Image
    Windows Firefox 56.0
    5 年前
    2021-7-01 7:20:37

    了解了,努力!

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇