ValueError:未知MS编译器版本1900 [英] ValueError: Unknown MS Compiler version 1900

查看:1464
本文介绍了ValueError:未知MS编译器版本1900的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用cygwin(mingw)在Windows 10上使用Python 3.5运行一些代码。准确地说,我使用PyDSTool模块,我在这里调用dopri积分器。问题是,我遇到麻烦与 distutils 不能识别Microsoft Visual Studio 2015.有一种方法来避免这一点(不回到旧版本的Python,Windows,Visual工作室)。

  ValueError回溯(最近一次调用)
< ipython-input- 16-bfeb915bfd7b> in< module>()
60 print(\\\

61
---> 62 testODE = Dopri_ODEsystem(DSargs)
63
64 print('Integrating ...')

C:\Anaconda3\lib\site-packages\PyDSTool \Generator\Dopri_ODEsystem.py in __init __(self,kw)
371 print(使用makeLibSource和compileLib方法的阶段)
372 else:
- > 373 self.makeLib()
374
375 @property

C:\Anaconda3\lib\site-packages\PyDSTool\Generator\mixins.py在makeLib(self,libsources,libdirs,include)
98 self.forceLibRefresh()
99 self.makeLibSource(include)
- > 100 self.compileLib(libsources,libdirs)
101
102 @property

C:\Anaconda3\lib\site-packages\PyDSTool\Generator\ mixins.py在compileLib(self,libsources,libdirs)
78预编译库。
79
---> 80 self._builder.build(libsources,libdirs,self。 _compiler)
81
82 def forceLibRefresh(self):

C:\Anaconda3\lib\site-packages\PyDSTool\Generator\mixins.py in build(self,libsources,libdirs,compiler)
187 script_args = script_args,
188 ext_modules = [extmod],
- > 189 py_modules = [self.modname])
190
191 def save_vfield(self,code,fname = None):

C:\Anaconda3\lib\site-packages\\\
umpy\distutils\core .py in setup(** attr)
167 new_attr ['distclass'] = NumpyDistribution
168
- > 169 return old_setup(** new_attr)
170
171 def _check_append_library(libraries,item):

C:\Anaconda3\lib\distutils\core.py in setup(** attrs)
146如果确定:
147 try:
- > 148 dist.run_commands()
149除了KeyboardInterrupt:
150 raise SystemExit(interrupted)

C:\Anaconda3\lib\distutils\dist.py在run_commands(self)
953
954 for cmd in self.commands:
- > 955 self.run_command(cmd)
956
957 # - 在其命令上操作的方法--------------------------

C:\Anaconda3\在$ run $($)
972 cmd_obj = self.get_command_obj(command)
973 cmd_obj.ensure_finalized()
- > 974 cmd_obj。 run()
975 self.have_run [command] = 1
976

C:\Anaconda3\lib\site-packages\\\
umpy\distutils\命令\build_ext.py in run(self)
115 verbose = self.verbose,
116 dry_run = self.dry_run,
- > 117 force = self.force)
118 self.compiler.customize(self.distribution)
119 self.compiler.customize_cmd(self)

C:\Anaconda3\lib\site-packages\\\
umpy \ distutils \ ccompiler.py in new_compiler(plat,compiler,verbose,dry_run,force)
594 raise DistutilsModuleError((无法编译C / C ++代码:无法找到类'%s'
595in module'%s')%(class_name,module_name))
- > 596 compiler = klass(None,dry_run,force)
597 log.debug('new_compiler返回%s'%(klass))
598返回编译器

C:\ Anaconda3 \lib\site-packages\\\
umpy\distutils\mingw32ccompiler.py in __init __(self,verbose,dry_run,force)
56
57 distutils.cygwinccompiler.CygwinCCompiler .__ init__ ,verbose,
---> 58 dry_run,force)
59
60#我们需要支持3.2不符合标准

C: \Anaconda3 \lib \distutils\cygwinccompiler.py in __init __(self,verbose,dry_run,force)
159#如果构建了Python,包括相应的MSVC运行时库
160#with MSVC 7.0或以后。
- > 161 self.dll_libraries = get_msvcr()
162
163 def _compile(self,obj,src,ext,cc_args,extra_postargs,pp_opts):

C:\Anaconda3\\ \\ lib \distutils\cygwinccompiler.py在get_msvcr()
88#return ['vcruntime140']
89 else:
---> 90 raise ValueError(未知的MS编译器版本%s%msc_ver)
91
92

ValueError:未知MS编译器版本1900


解决方案

Distutils和Numpy / Distutils目前不支持Visual Studio 2015,Visual C ++ 14.以下提示根据Python错误报告,我能够修补必要的文件,并使用新的安装成功构建扩展的Python 3.5从Anaconda和Mingw64与GCC 5.2.0在MSYS2在Windows 7上运行。我没有安装Visual Studio。解决方案是修补一个distutils文件和两个numpy / distutils文件(如果适用)。



您可以自行应用这些补丁以快速修复:





UPDATE



请注意,对我来说,它不被接受列入上游。 VS 2015的变化比我所欣赏的更复杂。


I am trying to run some code with Python 3.5 on Windows 10 with the use of cygwin (mingw). To be precise I am using the PyDSTool module, where I call the dopri integrator. The problem is, I am having trouble with distutils not recognizing Microsoft Visual Studio 2015. Is there a way to avoid this (without going back to older versions of Python, Windows, Visual Studio). The full Error can be seen bellow.

ValueError                                Traceback (most recent call last)
<ipython-input-16-bfeb915bfd7b> in <module>()
     60 print("\n")
     61 
---> 62 testODE = Dopri_ODEsystem(DSargs)
     63 
     64 print('Integrating...')

C:\Anaconda3\lib\site-packages\PyDSTool\Generator\Dopri_ODEsystem.py in __init__(self, kw)
    371             print("stages using the makeLibSource and compileLib methods.")
    372         else:
--> 373             self.makeLib()
    374 
    375     @property

C:\Anaconda3\lib\site-packages\PyDSTool\Generator\mixins.py in makeLib(self, libsources, libdirs, include)
     98             self.forceLibRefresh()
     99         self.makeLibSource(include)
--> 100         self.compileLib(libsources, libdirs)
    101 
    102     @property

C:\Anaconda3\lib\site-packages\PyDSTool\Generator\mixins.py in compileLib(self, libsources, libdirs)
     78           precompiled libraries."""
     79 
---> 80         self._builder.build(libsources, libdirs, self._compiler)
     81 
     82     def forceLibRefresh(self):

C:\Anaconda3\lib\site-packages\PyDSTool\Generator\mixins.py in build(self, libsources, libdirs, compiler)
    187                   script_args=script_args,
    188                   ext_modules=[extmod],
--> 189                   py_modules=[self.modname])
    190 
    191     def save_vfield(self, code, fname=None):

C:\Anaconda3\lib\site-packages\numpy\distutils\core.py in setup(**attr)
    167     new_attr['distclass'] = NumpyDistribution
    168 
--> 169     return old_setup(**new_attr)
    170 
    171 def _check_append_library(libraries, item):

C:\Anaconda3\lib\distutils\core.py in setup(**attrs)
    146     if ok:
    147         try:
--> 148             dist.run_commands()
    149         except KeyboardInterrupt:
    150             raise SystemExit("interrupted")

C:\Anaconda3\lib\distutils\dist.py in run_commands(self)
    953         """
    954         for cmd in self.commands:
--> 955             self.run_command(cmd)
    956 
    957     # -- Methods that operate on its Commands --------------------------

C:\Anaconda3\lib\distutils\dist.py in run_command(self, command)
    972         cmd_obj = self.get_command_obj(command)
    973         cmd_obj.ensure_finalized()
--> 974         cmd_obj.run()
    975         self.have_run[command] = 1
    976 

C:\Anaconda3\lib\site-packages\numpy\distutils\command\build_ext.py in run(self)
    115                                      verbose=self.verbose,
    116                                      dry_run=self.dry_run,
--> 117                                      force=self.force)
    118         self.compiler.customize(self.distribution)
    119         self.compiler.customize_cmd(self)

C:\Anaconda3\lib\site-packages\numpy\distutils\ccompiler.py in new_compiler(plat, compiler, verbose, dry_run, force)
    594         raise DistutilsModuleError(("can't compile C/C++ code: unable to find class '%s' " +
    595                "in module '%s'") % (class_name, module_name))
--> 596     compiler = klass(None, dry_run, force)
    597     log.debug('new_compiler returns %s' % (klass))
    598     return compiler

C:\Anaconda3\lib\site-packages\numpy\distutils\mingw32ccompiler.py in __init__(self, verbose, dry_run, force)
     56 
     57         distutils.cygwinccompiler.CygwinCCompiler.__init__ (self, verbose,
---> 58                                                             dry_run, force)
     59 
     60         # we need to support 3.2 which doesn't match the standard

C:\Anaconda3\lib\distutils\cygwinccompiler.py in __init__(self, verbose, dry_run, force)
    159             # Include the appropriate MSVC runtime library if Python was built
    160             # with MSVC 7.0 or later.
--> 161             self.dll_libraries = get_msvcr()
    162 
    163     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):

C:\Anaconda3\lib\distutils\cygwinccompiler.py in get_msvcr()
     88         #     return ['vcruntime140']
     89         else:
---> 90             raise ValueError("Unknown MS Compiler version %s " % msc_ver)
     91 
     92 

ValueError: Unknown MS Compiler version 1900 

解决方案

Distutils and Numpy/Distutils currently do not have support for Visual Studio 2015, Visual C++ 14. Following tips drawn from the Python bug report, I was able to patch the necessary files and successfully build extension using a new install of Python 3.5 from Anaconda and Mingw64 with GCC 5.2.0 running within MSYS2 on Windows 7. I do not have Visual Studio installed. The solution was to patch one distutils file and two numpy/distutils files (if this applies). These patches have been submitted for inclusion in future revisions.

You can apply the patches yourself for a quick fix:

UPDATE

Please note that while the patches above worked for me it was not accepted for inclusion in upstream. The changes that came with VS 2015 are more complex than I appreciated.

这篇关于ValueError:未知MS编译器版本1900的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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