gpt4 book ai didi

python - 在 Ubuntu 12.04 中安装 psycopg2 时出错

转载 作者:太空宇宙 更新时间:2023-11-04 04:08:09 24 4
gpt4 key购买 nike

我在将 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)

最佳答案

我已经解决了。将 gcc 升级到 4.8.2 即可完成工作。不管怎样,谢谢。

关于python - 在 Ubuntu 12.04 中安装 psycopg2 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20317606/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com