简体   繁体   English

错误:命令'gcc'在安装pygresql时失败,退出状态为1

[英]error : command 'gcc' failed with exit status 1 while installing pygresql

I am trying to install the pygresql package using "pip install pygresql" but I get the error : command 'gcc' failed with exit status 1 I've tried a lot of thing but I still do not understand why it is not working 我正在尝试使用“pip install pygresql”安装pygresql包但我收到错误:命令'gcc'失败,退出状态1我尝试了很多东西但我仍然不明白为什么它不工作

Collecting pygresql
  Using cached PyGreSQL-5.0.3.tar.gz
Building wheels for collected packages: pygresql
  Running setup.py bdist_wheel for pygresql ... error
  Complete output from command /Users/paulinelanquetin/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/y9/vbfql6394h3g6_4ldhwqzx1c0000gp/T/pip-build-s7kjrkvj/pygresql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/y9/vbfql6394h3g6_4ldhwqzx1c0000gp/T/tmpvvbd5puepip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.6
  copying pg.py -> build/lib.macosx-10.7-x86_64-3.6
  copying pgdb.py -> build/lib.macosx-10.7-x86_64-3.6
  running build_ext
  building '_pg' extension
  creating build/temp.macosx-10.7-x86_64-3.6
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/paulinelanquetin/anaconda/include -arch x86_64 -I/Users/paulinelanquetin/anaconda/include -arch x86_64 -DPYGRESQL_VERSION=5.0.3 -DDIRECT_ACCESS -DLARGE_OBJECTS -DDEFAULT_VARS -DESCAPING_FUNCS -I/Users/paulinelanquetin/anaconda/include/python3.6m -I/usr/local/Cellar/postgresql/9.6.2/include -I/Users/paulinelanquetin/anaconda/include/python3.6m -c pgmodule.c -o build/temp.macosx-10.7-x86_64-3.6/pgmodule.o -O2 -funsigned-char -Wall -Werror
  pgmodule.c:3694:3: error: code will never be executed [-Werror,-Wunreachable-code]
                  long    num_rows;
                  ^~~~~~~~~~~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pygresql
  Running setup.py clean for pygresql
Failed to build pygresql
Installing collected packages: pygresql
  Running setup.py install for pygresql ... error
    Complete output from command /Users/paulinelanquetin/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/y9/vbfql6394h3g6_4ldhwqzx1c0000gp/T/pip-build-s7kjrkvj/pygresql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/y9/vbfql6394h3g6_4ldhwqzx1c0000gp/T/pip-l99qu955-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    copying pg.py -> build/lib.macosx-10.7-x86_64-3.6
    copying pgdb.py -> build/lib.macosx-10.7-x86_64-3.6
    running build_ext
    building '_pg' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/paulinelanquetin/anaconda/include -arch x86_64 -I/Users/paulinelanquetin/anaconda/include -arch x86_64 -DPYGRESQL_VERSION=5.0.3 -DDIRECT_ACCESS -DLARGE_OBJECTS -DDEFAULT_VARS -DESCAPING_FUNCS -I/Users/paulinelanquetin/anaconda/include/python3.6m -I/usr/local/Cellar/postgresql/9.6.2/include -I/Users/paulinelanquetin/anaconda/include/python3.6m -c pgmodule.c -o build/temp.macosx-10.7-x86_64-3.6/pgmodule.o -O2 -funsigned-char -Wall -Werror
    pgmodule.c:3694:3: error: code will never be executed [-Werror,-Wunreachable-code]
                    long    num_rows;
                    ^~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/paulinelanquetin/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/y9/vbfql6394h3g6_4ldhwqzx1c0000gp/T/pip-build-s7kjrkvj/pygresql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/y9/vbfql6394h3g6_4ldhwqzx1c0000gp/T/pip-l99qu955-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/y9/vbfql6394h3g6_4ldhwqzx1c0000gp/T/pip-build-s7kjrkvj/pygresql/

I have two solutions to this problem that I was able to find. 我有两个解决这个问题的方法,我能够找到。 I ran into this exact problem trying to install pygresql into a conda vitrual environment on OSX Sierra 10.12.5 and with the gcc installed from xcode-select --install. 我遇到了这个问题,试图将pygresql安装到OSX Sierra 10.12.5上的conda vitrual环境中,并从xcode-select --install安装gcc。 My solution for this (if others find this) was to use this command in the terminal: 我的解决方案(如果其他人发现这个)是在终端中使用此命令:

conda install gcc

This solved the problem for installing into the conda environment which you could use as a work-around. 这解决了安装到conda环境中的问题,您可以将其用作解决方法。 Install anaconda or miniconda then run these commands in the terminal: 安装anacondaminiconda然后在终端中运行以下命令:

conda create -y python=3 --name my_env
source activate my_env
conda install -y gcc
pip install pygresql

I highly recommend using conda or virtualenv when doing development in python to avoid this types of issues. 我强烈建议在python中进行开发时使用conda或virtualenv来避免这类问题。

The more direct solution to your problem I found in this similar issue . 我在这个类似的问题中发现了更直接的问题解决方案。 I was able to solve pip installing directly into the OSX python (not the conda env) by running these commands in the terminal: 通过在终端中运行这些命令,我​​能够直接解决pip安装到OSX python(而不是conda env):

export CFLAGS="-Wno-error"
pip install PyGreSQL

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:安装crf ++时,命令'gcc'失败,退出状态为1 - Error: command 'gcc' failed with exit status 1 while installing crf++ 安装PIL 1.1.6。 (错误:命令“ gcc”失败,退出状态为1) - Installing PIL 1.1.6. ( error: command 'gcc' failed with exit status 1 ) 错误命令gcc失败,退出状态为1 - error command gcc failed with exit status 1 在 mac 上安装 pygame 时出错:错误:命令“gcc”失败,退出状态为 1 - error when installing pygame on mac: error: command 'gcc' failed with exit status 1 安装 psycopg2 完全失败。 巨大的错误消息(例如错误:命令 'gcc' failed with exit status 1) - Installing psycopg2 fails completely. Huge error message (such as error: command 'gcc' failed with exit status 1) GCC错误:命令'gcc-4.0'失败,退出状态为1 - GCC error: command 'gcc-4.0' failed with exit status 1 biopython安装:错误:命令“ gcc”失败,退出状态为1 - biopython installation: error: command 'gcc' failed with exit status 1 安装pandas的问题:“命令'llvm-gcc-4.2'失败,退出状态为1” - Issues installing pandas: “command 'llvm-gcc-4.2' failed with exit status 1” 通过 pip 错误(macos)安装瓶颈错误:瓶颈的构建轮失败; 错误:命令“gcc”失败,退出状态为 1 - install bottleneck by pip error (macos) ERROR: Failed building wheel for bottleneck; error: command 'gcc' failed with exit status 1 错误:命令“gcc”失败,退出状态为 1 -Python3.7 MacOs Catalina - error: command 'gcc' failed with exit status 1 -Python3.7 MacOs Catalina
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM