1

を使用してソースを構築しようとしていpythonますdistutils。私は簡単なサンプルを作成しましたがsetup.py提案どおりにビルドするとうまくいきます:

python setup.py build

必要なコンパイラでソースをビルドできるようになりました。コンパイラのリストは次のように見つけることができます

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) を使用していますか?問題のあるオプションを「削除」する必要がありますか?

4

2 に答える 2