2017-02-11 2 views
1

에 VIRTUALENV를 사용하여 PyGreSQL를 설치하는 방법이 응용 프로그램은 데이터베이스와 연결 종속성으로 PyGreSQL 5.0.3를 사용합니다.플라스크 microframework 및 <code>PostgreSQL</code> 데이터베이스를 사용하여 파이썬에서 개발 된 기존의 웹 서비스 응용 프로그램과 함께 작동하도록 내가 <code>virtualenv</code> 구성하고있어 맥 OS 시에라

나는 PostgreSQL 9.6.1 설치, 내가 사용하여 설치 :

brew install postgresql

내가

pip install -r requirements.txt

를 실행하면 I 설치 및 파이썬 2.7

작업 한 난 이 오류 메시지가 표시됩니다.

Running setup.py install for PyGreSQL ... error 
Complete output from command /Users/user/Development/Projects/flask/ws/myenv/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/t1/x7lrbmyd3lq0k8ngknwg1zx00000gn/T/pip-build-KjQgiU/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/t1/x7lrbmyd3lq0k8ngknwg1zx00000gn/T/pip-3lBp1N-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/user/Development/Projects/flask/ws/myenv/include/site/python2.7/PyGreSQL: 
running install 
running build 
running build_py 
creating build 
creating build/lib.macosx-10.12-intel-2.7 
copying pg.py -> build/lib.macosx-10.12-intel-2.7 
copying pgdb.py -> build/lib.macosx-10.12-intel-2.7 
running build_ext 
building '_pg' extension 
creating build/temp.macosx-10.12-intel-2.7 
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYGRESQL_VERSION=5.0.3 -DDIRECT_ACCESS -DLARGE_OBJECTS -DDEFAULT_VARS -DESCAPING_FUNCS -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/Cellar/postgresql/9.6.1/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pgmodule.c -o build/temp.macosx-10.12-intel-2.7/pgmodule.o -O2 -funsigned-char -Wall -Werror 
pgmodule.c:4143:9: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32] 
       num = PyInt_AsLong(param); 
        ~ ^~~~~~~~~~~~~~~~~~~ 
pgmodule.c:4448:12: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32] 
       pgport = PyInt_AsLong(pg_default_port); 
         ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
2 errors generated. 
error: command 'cc' failed with exit status 1 

---------------------------------------- 

이 오류는 패키지를 컴파일하고 빌드 한 결과이지만 postgresql 라이브러리가 설치되어 있는데 다른 경우에는 일반적인 문제로 나타납니다. 반면에 나는 맥의 명령 줄 도구를 설치 한, 내가 cc에서 gcc 내 컴파일러를 변경하고 내가 같은 오류

그것을 해결하는 방법을 어떤 생각을 가지고있어, 사전

답변

4

I에 감사합니다 이 패키지의 모든 버전을 정상적으로 설치할 수 없습니다. 아마도 패키지에 문제가있을 것입니다.

해결 방법 : warn-as-error를 해제하면 잘 컴파일되어야합니다.

export CFLAGS="-Wno-error" 
pip install PyGreSQL 
관련 문제