Force compiler when running python setup.py install

前端 未结 4 1842
后悔当初
后悔当初 2021-02-04 00:40

Is there a way to explicitly force the compiler for building Cython extensions when running python setup.py install? Where setup.py is of the form:

4条回答
  •  渐次进展
    2021-02-04 00:52

    Well I found a trick in my case : I wanted to use MSVC14.0 (from buildtools 2015) and NOT MSVC14.1 (buildtools 2017). I edited the file Lib\distutils_msvccompiler.py. There is a method

    _find_vcvarsall 
    

    which is calling

    best_version, best_dir = _find_vc2017()
    

    I replaced this call by

    best_version, best_dir = _find_vc2015()
    

    Do not forget to undo this dirty trick once compiled.

提交回复
热议问题