开发者

Python distutils with multiple versions of Visual C++

开发者 https://www.devze.com 2023-03-19 03:22 出处:网络
I have both Visual C++ 9.0 and 10.0 installed. I have a Python extension which uses swig. The setup.py script looks something like the following:

I have both Visual C++ 9.0 and 10.0 installed. I have a Python extension which uses swig. The setup.py script looks something like the following:

#! /usr/bin/env python

# System imports
from distutils.core import *
from distutils      import sysconfig

# Third-party modules - we depend on numpy for everything
import numpy

# Obtain the numpy include directory.  This logic works across numpy versions.
try:
    numpy_include = numpy.get_include()
except AttributeError:
    numpy_include = numpy.get_numpy_include()

# ezrange extension module
module = Extension("_mymodule",
                   ["mymodule.i","mymodule.cpp"],
                   include_dirs = [numpy_include], language="c++", swig_opts=['-c++']
                   )

# ezrange setup
setup(  name        = "mymodule",
        description = "Performs some functionality",
        author      = "Ben",
        version     = "1.0",
        ext_modules = [module]
        )

When I run python setup.py build, the compilation fails because the Visual C++ 9.0 compiler i开发者_StackOverflows used. I have to use version 10.0 (C++0x features). How can I achieve this in a portable way? (It should still work on Linux)

0

精彩评论

暂无评论...
验证码 换一张
取 消