2016-06-28 54 views
0

我试图安装包hgvs,它需要psycopg2才能正常工作。安装使用PIP顺利运行,直到出现以下错误:在EC2实例中安装psycopg2的问题

/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)解决。 我不知道有多少的影响,这个剧本,但在运行命令和apt-get安装的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). 

不幸的是,我发现已经反应了一个神奇的类似的问题为一些问题解决了问题。这些都没有奏效,更不用说解释这个问题的下层原因。如果有人可以帮助,那将是非常感激。

回答

0

使用此下面的命令,将工作

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 
+0

'命令和apt-get安装-y python3.4-dev的 读取软件包列表...完成 大厦的依赖关系树 读取状态信息...完成E:找不到包python3.4-dev E:找不到任何包'python3.4-dev' E:通过正则表达式'python3.4-dev''找不到任何包 虽然目前安装了python 3.3。其他命令返回,我的包都是最新的,尽管给我类似的警告给我原来的问题(第二代码块)。 –

+0

将这个“python3.4-dev”改为“python3-dev” – error2007s

+0

'python3已经是最新的版本(3.3.1-0ubuntu1)。 您可能想要运行'apt-get -f install'来更正这些: 以下软件包具有未满足的依赖关系:apt-utils:取决于:libdb5.3,但它不可安装 libapt-pkg5.0:打破:libapt -inst1.5(<0.9.9〜)但要安装0.9.7.7ubuntu6 libc-bin:取决于:libc6(<2.18)但要安装2.21-7' 我应该尝试卸载并重新安装使用'apt-get -f install'创建问题的依赖关系? –