gpt4 book ai didi

python + 导入 C++ 编码帮助。 MSVCCompiler 缺少 compiler_cxx 修复程序;无法找到 vcvarsall.bat

转载 作者:太空宇宙 更新时间:2023-11-04 06:32:48 25 4
gpt4 key购买 nike

我有 scipy 和 numpy。所以我安装了 MinGW 以及 Cygwin。我将路径 o MinGW 添加到我的 环境变量。但是当我运行我的 python 代码时,它会显示此错误消息。

*numpy.distutils 中没有名为 msvccompiler 的模块;从 distutils 尝试 缺少针对 MSVCCompiler* 的 compiler_cxx 修复

Traceback (most recent call last):
File "C:\Python27\jicrd_simulation.py", line 633, in <module>
cProfile.run('run()','infoprof_c_old')
File "C:\Python27\lib\cProfile.py", line 29, in run
prof = prof.run(statement)
File "C:\Python27\lib\cProfile.py", line 135, in run
return self.runctx(cmd, dict, dict)
File "C:\Python27\lib\cProfile.py", line 140, in runctx
exec cmd in globals, locals
File "<string>", line 1, in <module>
File "C:\Python27\jicrd_simulation.py", line 615, in run
P,trace=search(g)
File "C:\Python27\jicrd_simulation.py", line 580, in search
hits=compute_hits(g,pos,P)
File "C:\Python27\jicrd_simulation.py", line 299, in compute_hits
source_counts = thetarange(g,g.source,move)
File "C:\Python27\jicrd_simulation.py", line 229, in thetarange
headers=['<stdio.h>','<stdlib.h>','<math.h>','"'+g.path +'/comp.h"'])
File "C:\Python27\lib\site-packages\scipy\weave\inline_tools.py", line 355, in inline
**kw)
File "C:\Python27\lib\site-packages\scipy\weave\inline_tools.py", line 482, in compile_function
verbose=verbose, **kw)
File "C:\Python27\lib\site-packages\scipy\weave\ext_tools.py", line 367, in compile
verbose = verbose, **kw)
File "C:\Python27\lib\site-packages\scipy\weave\build_tools.py", line 272, in build_extension
setup(name = module_name, ext_modules = [ext],verbose=verb)
File "C:\Python27\lib\site-packages\numpy\distutils\core.py", line 186, in setup
return old_setup(**new_attr)
File "C:\Python27\lib\distutils\core.py", line 169, in setup
raise SystemExit, "error: " + str(msg)
CompileError: error: Unable to find vcvarsall.bat

那我现在该怎么办呢?我有一个 MSVCCCompiler。

最佳答案

当您谈论 C++ 编码时,我假设您想要编译 C/C++ 扩展。我使用 MinGW 在 Win32 上编译 C 扩展的方法是显式附加编译器:

python setup.py build_ext --compiler mingw32

如果你想为 Win64 编译,MinGW 似乎不是最好的选择。我使用了提示 herehere并使用 Microsoft SDK 中的 VC++ 10 编译我的扩展。

关于python + 导入 C++ 编码帮助。 MSVCCompiler 缺少 compiler_cxx 修复程序;无法找到 vcvarsall.bat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14888152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com