Django 错误:命令';gcc&x27;失败,退出状态为1 Fedora psycopg2

Django 错误:命令';gcc&x27;失败,退出状态为1 Fedora psycopg2,django,virtualenv,Django,Virtualenv,我试着开始使用virtualenv,但我没有多少收益。我一直面临很多问题,其中之一就是: (houenv)[user@localhost project]$ pip install psycopg2 Collecting psycopg2 Using cached psycopg2-2.6.1.tar.gz Installing collected packages: psycopg2 Running setup.py install for psycopg2 Complete

我试着开始使用virtualenv,但我没有多少收益。我一直面临很多问题,其中之一就是:

(houenv)[user@localhost project]$ pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.6.1.tar.gz
Installing collected packages: psycopg2
  Running setup.py install for psycopg2
    Complete output from command /home/user/environments/houenv/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-sp_ab5gw/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-aiybv08u-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/environments/houenv/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 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090405 -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
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/user/environments/houenv/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-sp_ab5gw/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-aiybv08u-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/environments/houenv/include/site/python3.4/psycopg2" failed with error code 1 in /tmp/pip-build-sp_ab5gw/psycopg2
我已经安装了:

sudo-yum安装postgresql-libs 蟒蛇3 sudoyum安装gcc

解决方案 sudo apt get安装libpq dev python3 dev

还是软呢帽


sudo-yum安装python3-devel-postgresql-devel

您使用的是pip-verison
python2.7
,您安装的是
python3-dev
。您可以使用python3-dev安装
pip3
,或者安装
python-dev
并使用默认的
pip
您使用的是pip-verison
python2.7
,您安装的是
python3-dev
。您可以使用python3 dev安装
pip3
,或者安装
python dev
并使用默认的
pip
,“包postgresql-devel-9.4.5-1.fc23.x86_64已安装,正在跳过。”我也安装了它。请检查您的pip版本
pip--version
,并在此处共享输出检查,同时检查build essential是否已安装
yum install build essential
我在Ubuntu上安装了该项目,同样的问题也发生了。我安装了
pythondev
,它运行正常。这就是为什么我要求您测试pip版本,因为您安装了python3dev,而pip是pip2.7@电动汽车。我更新了这篇文章,以便读者能够理解。“已经安装了postgresql-devel-9.4.5-1.fc23.x86_64包,正在跳过。”我也安装了它。请检查您的pip版本
pip--version
,并在此处共享输出检查,同时检查build essential是否已安装
yum install build essential
我在Ubuntu上安装了该项目,同样的问题也发生了。我安装了
pythondev
,它运行正常。这就是为什么我要求您测试pip版本,因为您安装了python3dev,而pip是pip2.7@电动汽车。我更新了这篇文章,所以读者可以理解。