gpt4 book ai didi

ubuntu - 在 EC2 实例中安装 psycopg2 的问题

转载 作者:太空宇宙 更新时间:2023-11-03 17:10:42 24 4
gpt4 key购买 nike

我一直在尝试安装软件包 hgvs ,这需要 psycopg2 才能正常工作。使用pip安装顺利运行,直到出现如下错误:

/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpq.a(fe-connect.o): unrecognized relocation (0x2a) in section `.text'

/usr/bin/ld: final link failed: Bad value

collect2: error: ld returned 1 exit status

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-ubuntu/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rh6BEQ-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-ubuntu/psycopg2

通过安装 python-dev 和 libpq-dev 解决了类似的错误,它们已经是最新版本(2.7.4 和 9.5.3)。我不知道这有多大影响,但在运行 sudo apt-get install libpq-dev 时,我得到:

Reading package lists... Done
Building dependency tree
Reading state information... Done
libpq-dev is already the newest version (9.5.3-1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
apt-utils : Depends: libdb5.3 but it is not installable
libapt-pkg5.0 : Breaks: libapt-inst1.5 (< 0.9.9~) but 0.9.7.7ubuntu6 is to be installed
libc-bin : Depends: libc6 (< 2.18) but 2.21-7 is to be installed
libc-dev-bin : Depends: libc6 (< 2.18) but 2.21-7 is to be installed
libc6 : Breaks: libtirpc1 (< 0.2.3) but 0.2.2-5build1 is to be installed
Breaks: locales (< 2.21) but 2.13+git20120306-9 is to be installed
libc6-dev : Depends: libc6 (= 2.17-0ubuntu5.1) but 2.21-7 is to be installed
libpq-dev : Depends: libpq5 (= 9.5.3-1) but it is not installable
libstdc++6 : Depends: gcc-5-base (= 5.3.1-7) but it is not installable
Breaks: python-scipy (<= 0.14.1-1) but 0.11.0+dfsg1-1ubuntu2 is to be installed
Breaks: python3-scipy (<= 0.14.1-1) but 0.11.0+dfsg1-1ubuntu2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

不幸的是,我发现的类似问题已经用神奇的单行答案解决了一些问题。这些都没有用,更不用说解释问题的根本原因了。如果有人可以提供帮助,将不胜感激。

最佳答案

使用下面的命令就可以了

sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y python3.4-dev
sudo apt-get install -y libpq-dev

pip3 install psycopg2

关于ubuntu - 在 EC2 实例中安装 psycopg2 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38081801/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com