可以更改distutils默认的编译器选项吗? [英] Possible to change distutils default compiler options?

查看:393
本文介绍了可以更改distutils默认的编译器选项吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Win 10,x64,minGW64,Python 2.7,Anaconda

Win 10, x64, minGW64, Python 2.7, Anaconda

我正在尝试使用python setup.py build --compiler=mingw32

这是setup.py

Here's 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"""]
        ),
    ],
)

但是我不断收到以下错误信息...

But I keep getting the following error...

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'是不再是有效的编译选项,因此会出现错误.

From this post it appears that '-mno-cywin' is no longer a valid compilation option hence the error.

我找到了这篇文章关于Mac OS X 10.8.3的distutils编译器选项. &在某个地方得到distutils正在从原始Python安装中读取一些默认标志的信息,但我对如何更改它们并不明智.

I found this post about distutils compiler options for Mac OS X 10.8.3 & get that somewhere distutils is reading some default flags from the oringal Python install but I'm none the wiser about how to change them.

如何在Windows 10计算机上通过Python的Anaconda发行版(即缺少disutils.cfg)更改传递给distutils的编译器选项?

How do I change the compiler options passed to distutils on a Windows 10 machine with an Anaconda distribution of Python ie with disutils.cfg missing?

是否可以编写自己的distutils.cfg?

推荐答案

该选项位于

The option is in distutils/cygwinccompiler.py. If you can edit the file in the Python installation ­just remove it.

这篇关于可以更改distutils默认的编译器选项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆