Python 在Ubuntu 12.04中安装psycopg2时出错

Python 在Ubuntu 12.04中安装psycopg2时出错,python,linux,gcc,pip,psycopg2,Python,Linux,Gcc,Pip,Psycopg2,我在将psycopg2安装到virtualenv中时遇到一些问题。以下是pip安装psycopg2的输出 注1:我检查了大量StackOverflow答案,并安装了所有建议的*-dev软件包。这里有什么提示吗 注意2:我从源代码上的python setup.py安装获得了相同的输出 Downloading/unpacking psycopg2 Downloading psycopg2-2.5.1.tar.gz (684kB): 684kB downloaded Running setup

我在将psycopg2安装到virtualenv中时遇到一些问题。以下是
pip安装psycopg2
的输出

注1:我检查了大量StackOverflow答案,并安装了所有建议的*-dev软件包。这里有什么提示吗

注意2:我从源代码上的
python setup.py安装获得了相同的输出

Downloading/unpacking psycopg2
  Downloading psycopg2-2.5.1.tar.gz (684kB): 684kB downloaded
  Running setup.py egg_info for package psycopg2

Installing collected packages: psycopg2
  Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.1 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x09010A -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.1/server -c psycopg/psycopgmodule.c -o build/temp.linux-i686-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    In file included from /usr/include/string.h:642:0,
                     from /usr/include/python2.7/Python.h:38,
                     from ./psycopg/psycopg.h:30,
                     from psycopg/psycopgmodule.c:27:
    /usr/include/i386-linux-gnu/bits/string3.h: In function ‘memcpy’:
    /usr/include/i386-linux-gnu/bits/string3.h:52:3: internal compiler error: Segmentation fault
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
    Preprocessed source stored into /tmp/ccANjg96.out file, please attach this to your bugreport.
    error: command 'gcc' failed with exit status 1
    Complete output from command /webapps/sysacad_wrapper/bin/python -c "import setuptools;__file__='/webapps/sysacad_wrapper/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ixowrn-record/install-record.txt --single-version-externally-managed --install-headers /webapps/sysacad_wrapper/include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.linux-i686-2.7

creating build/lib.linux-i686-2.7/psycopg2

copying lib/tz.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/psycopg1.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/_json.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/extras.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/extensions.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/pool.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/errorcodes.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/_range.py -> build/lib.linux-i686-2.7/psycopg2

copying lib/__init__.py -> build/lib.linux-i686-2.7/psycopg2

creating build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_module.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_types_extras.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_lobject.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_copy.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_with.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_cancel.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_connection.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_quote.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/dbapi20.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/testconfig.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_bugX000.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_extras_dictcursor.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/testutils.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_transaction.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_bug_gc.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_dates.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_async.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/dbapi20_tpc.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_notify.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_green.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_types_basic.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/test_cursor.py -> build/lib.linux-i686-2.7/psycopg2/tests

copying tests/__init__.py -> build/lib.linux-i686-2.7/psycopg2/tests

running build_ext

building 'psycopg2._psycopg' extension

creating build/temp.linux-i686-2.7

creating build/temp.linux-i686-2.7/psycopg

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.1 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x09010A -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.1/server -c psycopg/psycopgmodule.c -o build/temp.linux-i686-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement

In file included from /usr/include/string.h:642:0,

                 from /usr/include/python2.7/Python.h:38,

                 from ./psycopg/psycopg.h:30,

                 from psycopg/psycopgmodule.c:27:

/usr/include/i386-linux-gnu/bits/string3.h: In function ‘memcpy’:

/usr/include/i386-linux-gnu/bits/string3.h:52:3: internal compiler error: Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

Preprocessed source stored into /tmp/ccANjg96.out file, please attach this to your bugreport.

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /webapps/sysacad_wrapper/bin/python -c "import setuptools;__file__='/webapps/sysacad_wrapper/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ixowrn-record/install-record.txt --single-version-externally-managed --install-headers /webapps/sysacad_wrapper/include/site/python2.7 failed with error code 1 in /webapps/sysacad_wrapper/build/psycopg2
Traceback (most recent call last):
  File "/webapps/sysacad_wrapper/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/webapps/sysacad_wrapper/local/lib/python2.7/site-packages/pip/__init__.py", line 148, in main
    return command.main(args[1:], options)
  File "/webapps/sysacad_wrapper/local/lib/python2.7/site-packages/pip/basecommand.py", line 169, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 60: ordinal not in range(128)
下载/解包psycopg2 下载psycopg2-2.5.1.tar.gz(684kB):下载684kB 正在为程序包psycopg2运行setup.py egg\u info 安装收集的软件包:psycopg2 正在为psycopg2运行setup.py安装 构建“psycopg2.\u psycopg”扩展 gcc-pthread-fno严格别名-DNDEBUG-g-fwrapv-O2-Wall-Wstrict原型-fPIC-DPSYCOPG_DEFAULT_PYDATETIME=1-DPSYCOPG_VERSION=“2.5.1(dt dec pq3 ext)”-DPG_VERSION_HEX=0x09010A-DPSYCOPG_EXTENSIONS=1-DPSYCOPG_NEW_BOOLEAN=1-DHAVE_pqfreemm=1-I/usr/python2.7-I-I/usr/include/postgresql-I/usr/include/postgresql/9.1/server-c psycopg/psycopgmodule.c-o build/temp.linux-i686-2.7/psycopg/psycopgmodule.o-wdeclation 在/usr/include/string.h:642:0中包含的文件中, from/usr/include/python2.7/Python.h:38, 发自./psycopg/psycopg.h:30, 来自psycopg/psycopgmodule.c:27: /usr/include/i386 linux gnu/bits/string3.h:在函数“memcpy”中: /usr/include/i386 linux gnu/bits/string3.h:52:3:内部编译器错误:分段错误 请提交完整的bug报告, 如果合适,使用预处理源。 有关说明,请参阅。 预处理的源代码存储在/tmp/ccANjg96.out文件中,请将其附加到您的bugreport中。 错误:命令“gcc”失败,退出状态为1 从命令/webapps/sysacad\u wrapper/bin/python-c“导入setuptools;\u文件\u=”/webapps/sysacad\u wrapper/build/psycopg2/setup.py';exec(compile(open)(open)(open(\u file___).read().replace('\r\n','\n'),\u文件u,'exec'))完成输出安装--record/tmp/pip-Ixowrn-record/install-record.txt--外部管理的单一版本--安装头/webapps/sysacad_-wrapper/include/site/python2.7: 正在运行的安装 运行构建 运行build\u py 创建构建 创建build/lib.linux-i686-2.7 创建build/lib.linux-i686-2.7/psycopg2 复制lib/tz.py->build/lib.linux-i686-2.7/psycopg2 复制lib/psycopg1.py->build/lib.linux-i686-2.7/psycopg2 正在复制lib/_json.py->build/lib.linux-i686-2.7/psycopg2 正在复制lib/extras.py->build/lib.linux-i686-2.7/psycopg2 复制lib/extensions.py->build/lib.linux-i686-2.7/psycopg2 正在复制lib/pool.py->build/lib.linux-i686-2.7/psycopg2 正在复制lib/errorcodes.py->build/lib.linux-i686-2.7/psycopg2 正在复制lib/_range.py->build/lib.linux-i686-2.7/psycopg2 正在复制lib/uuu init_uuuu.py->build/lib.linux-i686-2.7/psycopg2 创建build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_module.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/测试类型\u extras.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_lobject.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_copy.py->build/lib.linux-i686-2.7/psycopg2/tests 使用.py->build/lib.linux-i686-2.7/psycopg2/tests复制测试/test_ 复制测试/test\u cancel.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_connection.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_quote.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/dbapi20.py->build/lib.linux-i686-2.7/psycopg2/tests 正在复制测试/testconfig.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_bugX000.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test\u extras\u dictcursor.py->build/lib.linux-i686-2.7/psycopg2/tests 复制tests/testutils.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_transaction.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test\u bug\u gc.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_dates.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_async.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/dbapi20_tpc.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test\u notify.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test_green.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test\u types\u basic.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test\u psycopg2\u dbapi20.py->build/lib.linux-i686-2.7/psycopg2/tests 复制测试/test\u cursor.py->build/lib.linux-i686-2.7/psycopg2/tests 正在复制测试/_init__uuu.py->build/lib.linux-i686-2.7/psycopg2/tests 运行build_ext 构建“psycopg2.\u psycopg”扩展 创建build/temp.linux-i686-2.7 创建build/temp.linux-i686-2.7/psycopg gcc-pthread-fno严格别名-DNDEBUG-g-fwrapv-O2-Wall-Wstrict原型-fPIC-DPSYCOPG_DEFAULT_PYDATETIME=1-DPSYCOPG_VERSION=“2.5.1(dt dec pq3 ext)”-DPG_VERSION_HEX=0x09010A-DPSYCOPG_EXTENSIONS=1-DPSYCOPG_NEW_BOOLEAN=1-DHAVE_pqfreemm=1-I/usr/python2.7-I-I/usr/include/postgresql-I/usr/include/postgresql/9.1/server-c psycopg/psycopgmodule.c-o build/temp.linux-i686-2.7/psycopg/psycopgmodule.o-wdeclation 在/usr/include/string.h:642:0中包含的文件中, from/usr/include/python2.7/Python.h:38, 发自./psycopg/psycopg.h:30, 来自psycopg/psycopgmodule.c:27: /usr/include/i386 linux gnu/bits/string3.h:在函数“memcpy”中: /usr/include/i386 linux gnu/bits/string3.h:52:3:内部编译器错误:分段错误 请提交完整的bug报告, 如果合适,使用预处理源。 有关说明,请参阅。 预处理的源代码存储在/tmp/ccANjg96.out文件中,请将其附加到您的bugreport中。 错误:命令“gcc”失败,退出状态为1 ---------------------------------------- 清理。。。 Command/webapps/sysacad_wrapper/bin/python-c“导入setuptools;\uuuu文件”