2016-06-28 30 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'創建問題的依賴關係? –