可以更改 distutils 默认编译器选项吗?
Possible to change distutils default compiler options?
Win 10、x64、minGW64、Python2.7、Anaconda
我正在尝试使用 python setup.py build --compiler=mingw32
编译 zbar 以便在 Python 2.7 中使用
这里是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”不再是有效的编译选项,因此出现错误。
我发现 this post 关于 distutils
Mac OS X 10.8.3 的编译器选项并在某处找到 distutils
正在从中读取一些默认标志原始 Python 安装,但我 none 更了解如何更改它们。
如何在 Windows 10 机器上更改传递给 distutils
的编译器选项,Anaconda 发行版为 Python,即缺少 disutils.cfg
?
是否可以自己编写distutils.cfg
?
选项在distutils/cygwinccompiler.py中。如果您可以在 Python 安装中编辑该文件,请将其删除。
Win 10、x64、minGW64、Python2.7、Anaconda
我正在尝试使用 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
由此
我发现 this post 关于 distutils
Mac OS X 10.8.3 的编译器选项并在某处找到 distutils
正在从中读取一些默认标志原始 Python 安装,但我 none 更了解如何更改它们。
如何在 Windows 10 机器上更改传递给 distutils
的编译器选项,Anaconda 发行版为 Python,即缺少 disutils.cfg
?
是否可以自己编写distutils.cfg
?
选项在distutils/cygwinccompiler.py中。如果您可以在 Python 安装中编辑该文件,请将其删除。