Ubuntu服务器16.04无法为psycopg2构建轮

时间:2016-09-01 13:41:33

标签: python django virtualenv psycopg2 postgresql-9.3

我正在设置我的新服务器(ubuntu 16.04.01),我需要使用postgres(9.3)+ virtualenv + python + django(1.6)+ nginx ecc设置我的系统..

我已经在2年前在ubuntu 14.04上设置了相同的系统,没有任何问题,但现在在新的lts上,我无法安装psycopg2。

当我从virtualenv尝试执行pip install psycopg2时,我收到此错误消息:

(gips) gips@gips-locale:~/gips/virtualenv/gestogips$ pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.6.2.tar.gz
Building wheels for collected packages: psycopg2
  Running setup.py bdist_wheel for psycopg2 ... error
  Complete output from command /home/gips/gips/virtualenv/gips/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-PF24T2/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp9wlqN9pip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/psycopg2
  copying lib/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/pool.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/errorcodes.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/extensions.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/_range.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/psycopg1.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/tz.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/_json.py -> build/lib.linux-x86_64-2.7/psycopg2
  copying lib/extras.py -> build/lib.linux-x86_64-2.7/psycopg2
  creating build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/testutils.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_lobject.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_types_basic.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_copy.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_transaction.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_bug_gc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_connection.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_green.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_bugX000.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_module.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_dates.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/testconfig.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_with.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_types_extras.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_cursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_cancel.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_errcodes.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_async.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_quote.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  copying tests/test_notify.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
  running build_ext
  building 'psycopg2._psycopg' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/psycopg
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 
-DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x09030E -DHAVE_LO64=1 -I/usr/include/python2.7 -I. 
-I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c 
-o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement

  unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
  Running setup.py install for psycopg2 ... error
    Complete output from command /home/gips/gips/virtualenv/gips/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-PF24T2/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ORPyfs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/gips/gips/virtualenv/gips/include/site/python2.7/psycopg2:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/psycopg2
    copying lib/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/pool.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/errorcodes.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/extensions.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/_range.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/psycopg1.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/tz.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/_json.py -> build/lib.linux-x86_64-2.7/psycopg2
    copying lib/extras.py -> build/lib.linux-x86_64-2.7/psycopg2
    creating build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/testutils.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_lobject.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_types_basic.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_copy.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_transaction.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_bug_gc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_connection.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_green.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_bugX000.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_module.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_dates.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/testconfig.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_with.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_types_extras.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_cursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_cancel.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_errcodes.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_async.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_quote.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    copying tests/test_notify.py -> build/lib.linux-x86_64-2.7/psycopg2/tests
    running build_ext
    building 'psycopg2._psycopg' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/psycopg
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 
-DPSYCOPG_VERSION="2.6.2 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x09030E -DHAVE_LO64=1 -I/usr/include/python2.7 -I. 
-I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c 
-o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/gips/gips/virtualenv/gips/bin/python2 -u -c "import setuptools, 
tokenize;__file__='/tmp/pip-build-PF24T2/psycopg2/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record /tmp/pip-ORPyfs-record/install-record.txt --single-version-externally-managed --compile 
--install-headers /home/gips/gips/virtualenv/gips/include/site/python2.7/psycopg2" 
failed with error code 1 in /tmp/pip-build-PF24T2/psycopg2/

任何想法?我已经阅读了一些建议运行的类似帖子

sudo apt-get install libpq-dev python-dev

但我已经完成了没有结果......仍然有相同的错误

0 个答案:

没有答案