2013-05-09 77 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

相关问题