2013-07-05 3 views
1

pythondistutils을 사용하여 소스를 빌드하려고합니다. I가 example 다음과 같은 간단한 setup.py 생성 및 제안을 구축하는 것은 잘 작동했다 :distutils로 C 확장을 빌드 할 때 인식 할 수없는 명령 줄 오류가 발생합니다.

python setup.py build 

지금은 원하는 컴파일러 소스를 구축 할 수 있습니다; 내가 사용하려고하면 컴파일러의 목록 can be found as

python setup.py build_ext --inplace --help-compiler 
List of available compilers: 
    --compiler=bcpp  Borland C++ Compiler 
    --compiler=cygwin Cygwin port of GNU C Compiler for Win32 
    --compiler=emx  EMX port of GNU C Compiler for OS/2 
    --compiler=mingw32 Mingw32 port of GNU C Compiler for Win32 
    --compiler=msvc  Microsoft Visual C++ 
    --compiler=unix  standard UNIX-style compiler 

그러나, 예를 들어, mingw32 컴파일러는 다음과 같이

python setup.py build --compiler=mingw32 

내가받을 다음과 같은 오류 출력 :

building 'demo' extension 
creating build 
creating build/temp.linux-i686-2.7 
gcc -mno-cygwin -mdll -O -Wall -DMAJOR_VERSION=1 -DMINOR_VERSION=0 -I/usr/local/include -I/usr/include/python2.7 -c demo.c -o build/temp.linux-i686-2.7/demo.o 
cc1: error: unrecognized command line option ‘-mno-cygwin’ 
cc1: error: unrecognized command line option ‘-mdll’ 
error: command 'gcc' failed with exit status 1 

무엇 이 문제의 원인은 무엇입니까? 내가 뭔가 잘못하고 있는거야? 다른 것을 지정해야합니까? 잘못된 버전 (Ubuntu 12.04, Python 2.7.3, Distutils 1.0a4)을 사용하고 있습니까? 문제의 옵션을 '제거'해야합니까?

답변

0

나는 당신이 정말로 MinGW를 우분투에 가지고 있다고 생각하지 않는다.

이미 인용으로

,

--compiler=mingw32 Mingw32 port of GNU C Compiler for Win32 

대신 --compiler=unix을 시도해야합니다.

+0

아하이피. 방금'sudo apt-get install gcc-mingw32'를 실행하여'mingw32'를 설치했지만 여전히 같은 오류가 발생합니다. – Alex

0

파이썬 개발 헤더를 설치하고 명령을 실행할 수 있습니까?

sudo apt-get install python-dev 
sudo apt-get install libevent-dev 
+0

이것이 사용 된 컴파일러 옵션 및/또는 컴파일러의 이해에 아무런 영향을 미치지 않는다고 생각합니다. – glglgl