2013-05-09 47 views
0

我在一個共享的託管服務提供商,試圖安裝psycopg2爲了得到Django和運行與psql。錯誤安裝psycopg2:無法識別的選項`-W聲明後語句'

我跑$ pip install psycopg2

,並得到了以下錯誤

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 
-fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5 (dt dec pq3 ext)" 
-DPG_VERSION_HEX=0x080205 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 
-DHAVE_PQFREEMEM=1 -I/home3/n/norcal/python/include/python2.7 -I. 
-I/usr/local/pgsql-8.2/include -I/usr/local/pgsql-8.2/include/server 
-c psycopg/psycopgmodule.c -o build/temp.linux-i686-2.7/psycopg/psycopgmodule.o 
-Wdeclaration-after-statement 

cc1: error: unrecognized option `-Wdeclaration-after-statement' 

error: command 'gcc' failed with exit status 1 

我做了一些谷歌上搜索,發現我可能會丟失蟒蛇-dev的和的libpq-dev的,但我無法找到上的說明如何安裝沒有aptitude的用戶 - 我無法訪問我的共享託管服務提供商。

任何想法?

非常感謝!

回答

0

問題是,您的gcc版本不支持-Wdeclaration-after-statement

hacky的解決方案是,從編譯命令中刪除這個不受支持的選項。更好的解決方案是,升級你的gcc。

您收到此錯誤後,grep來找到在哪裏declaration-after-statement使用:

$ grep -r "declaration-after-statement" ./virtual_env_dir 
virtual_env_dir/build/psycopg2/setup.py: '-Wdeclaration-after-statement') 

編輯setup.py和評論對應的代碼塊:

'''' 
for extension in self.extensions: 
    extension.extra_compile_args.append(
     '-Wdeclaration-after-statement') 
'''' 

重新運行構建通過$ pip install psycopg2

相關問題