[issue25250] AttributeError: 'MSVCCompiler' object has no attribute '_MSVCCompiler__version'

Matt Hickford report at bugs.python.org
Tue Sep 29 13:53:52 CEST 2015


Matt Hickford added the comment:

Hi Steve. Thanks for your reply. In the end I went with your something
similar to your third suggestion. It's important I wanted to condition on
what compiler distutils is using *now* to the build the extension on my
computer, rather than what compiler was originally used to build Python
(which needn't match).

On 29 September 2015 at 05:27, Steve Dower <report at bugs.python.org> wrote:

>
> Steve Dower added the comment:
>
> if sys.version_info[:2] >= (3, 3):
>     # MSVC version is >= 9.0
>
> Alternatively:
>
> if sys.version_info[:2] >= (3, 5):
>     # MSVC version is >= 14.0, or
>     # _msvccompiler.MSVCCompiler does not have __version
>
> or
>
> if self.compiler.compiler_type == "msvc" and int(getattr(self.compiler,
> '_MSVCCompiler__version'), 10) <= 9:
>     # MSVC version is >= 9.0
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue25250>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25250>
_______________________________________


More information about the Python-bugs-list mailing list