可以更改默认的distutils编译器选项?(Possible to change distutil

2019-10-29 04:43发布

运10,64,minGW64,Python 2.7版,蟒蛇

我想用编译zbar和使用在Python 2.7 python setup.py build --compiler=mingw32

下面是setup.py

from distutils.core import setup, Extension
from distutils.sysconfig import get_config_vars
setup(
    name = 'zbar',
    version = '0.10',
    author = 'Jeff Brown',
    author_email = 'spadix@users.sourceforge.net',
    url = 'http://zbar.sourceforge.net',
    description = 'read barcodes from images or video',
    license = 'LGPL',
    long_description = open('README').read(),
    classifiers = [
        'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'Environment :: Console',
        'Environment :: X11 Applications',
        'Environment :: Win32 (MS Windows)',
        'Operating System :: POSIX',
        'Operating System :: Unix',
        'Operating System :: Microsoft :: Windows',
        'Topic :: Communications',
        'Topic :: Multimedia :: Graphics',
        'Topic :: Software Development :: Libraries',
    ],
    ext_modules = [
        Extension('zbar', [
                'zbarmodule.c',
                'enum.c',
                'exception.c',
                'symbol.c',
                'symbolset.c',
                'symboliter.c',
                'image.c',
                'processor.c',
                'imagescanner.c',
                'decoder.c',
                'scanner.c',
                ],
            libraries = [ 'zbar' ],
            library_dirs=["""C:\Program Files (x86)\ZBar\lib"""],
            include_dirs=[get_config_vars('INCLUDEDIR'),
                              get_config_vars('INCLUDEPY'),
                             """C:\Program Files (x86)\ZBar\include"""]
        ),
    ],
)

但我不断收到以下错误......

running build
running build_ext
building 'zbar' extension
C:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DMS_WIN64 -I[None] -I['C:\\ProgramData\\Anaconda2\\include'] "-IC:\Program Files (x86)\ZBar\include" -IC:\ProgramData\Anaconda2\include -IC:\ProgramData\Anaconda2\PC -c zbarmodule.c -o build\temp.win-amd64-2.7\Release\zbarmodule.o
gcc: error: unrecognized command line option '-mno-cygwin'; did you mean '-mno-clwb'?
error: command 'C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gcc.exe' failed with exit status 1

从这个职位似乎“-mno-cywin”不再是一个有效的编译选项,因此错误。

我发现这个职位有关distutils为Mac OS X 10.8.3的编译器选项和获取地方distutils是阅读从oringal Python的一些默认标志安装,但我没有关于如何改变他们的聪明。

如何更改传递到编译器选项distutils在Windows 10的机器上使用Python即蟒蛇分布disutils.cfg失踪?

是否有可能写我自己distutils.cfg

Answer 1:

选项是的distutils / cygwinccompiler.py 。 如果你可以编辑Python安装文件只是将其删除。



文章来源: Possible to change distutils default compiler options?