【问题标题】:Error installing psycopg2 in Ubuntu 12.04在 Ubuntu 12.04 中安装 psycopg2 时出错
【发布时间】:2013-12-17 12:43:18
【问题描述】:

我在将 psycopg2 安装到 virtualenv 时遇到了一些问题。这是pip install psycopg2 的输出。

注意 1:我检查了很多 StackOverflow 答案,并安装了所有建议的 *-dev 包。这里有什么提示?

注意 2:我在源代码上从 python setup.py install 得到相同的输出。

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)

【问题讨论】:

    标签: python linux gcc pip psycopg2


    【解决方案1】:

    我已经解决了。将 gcc 升级到 4.8.2 完成了这项工作。还是谢谢。

    【讨论】:

      猜你喜欢
      • 2012-09-02
      • 2014-04-17
      • 2015-07-11
      • 1970-01-01
      • 2015-06-24
      • 1970-01-01
      • 2020-10-11
      • 2020-01-16
      • 2017-12-29
      相关资源
      最近更新 更多