有人可以帮助我安装psycopg2吗?我有:
- Fedora 21 3.19.5-200.fc21.x86_64 GNU/Linux;
- Python 2.7.8;
- Python 3.4.1;
- virtualenv 12.1.1;
- pip 6.1.1 (python 3.4) in virtualenv activated;
对于psycopg2,我安装了软件包(试图解决问题时):
- postgresql-devel
- python3-devel
- python-devel
- libpqxx-devel
- libpqxx
,但我仍然会在" PIP安装psycopg2"中遇到错误。
输出:
Collecting psycopg2
Using cached psycopg2-2.6.tar.gz
Installing collected packages: psycopg2
Running setup.py install for psycopg2
Complete output from command /home/dkhabarov/Projects/poll/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-mqhuy9y5/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-z4g3k4um-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/dkhabarov/Projects/poll/include/site/python3.4/psycopg2:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/psycopg1.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.4/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.4/psycopg2
creating build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_notify.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_connection.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_cursor.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_with.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/testutils.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_green.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/__init__.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_module.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_copy.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_lobject.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_dates.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_cancel.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_transaction.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_quote.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/testconfig.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_async.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
copying tests/dbapi20.py -> build/lib.linux-x86_64-3.4/psycopg2/tests
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/psycopg
gcc -pthread -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090306 -DHAVE_LO64=1 -I/usr/include/python3.4m -I. -I/usr/include -I/usr/include/pgsql/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.4/psycopg/psycopgmodule.o -Wdeclaration-after-statement
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/dkhabarov/Projects/poll/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-mqhuy9y5/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-z4g3k4um-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/dkhabarov/Projects/poll/include/site/python3.4/psycopg2" failed with error code 1 in /tmp/pip-build-mqhuy9y5/psycopg2
检查已安装的GCC,如果否:
sudo yum install gcc