由于“numpy.distutils._msvccompiler”,无法安装python脚本

问题描述 投票:0回答:1

我正在尝试安装我的同事多年前在我的计算机中构建的python脚本。我跑的时候

python setup.py install

我遇到了问题“没有名为'numpy.distutils._msvccompiler'的模块”

No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.

building 'grid' extension
compiling C sources
error: Unable to find vcvarsall.bat

我已经多次在网页上看到这个问题,但似乎没有人能完全解决这个问题。一些细节可能与我读过的内容相关:

  • 我在Windows上使用anaconda,而脚本是在ubuntu上开发的。
  • 我尝试在ubuntu中安装脚本,但我没有遇到任何问题。
  • 我见过几次微软VS提到过。我没有安装VS.我确实有VS代码,但我认为这是无关紧要的。

我认为它可能与某些软件包有关,所以我在anaconda中查找包含msvc的软件包并安装了msvc_runtime。它没有改变错误,所以我把它卸回来了。

我已经看到了答案(statsmodels installation: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils),他们提到了MS C ++编译器。我检查了我安装的那些,它们是2010年,2012年,2013年,2017年。

默认情况下,Anaconda安装了vs2015_runtime。由于我没有安装vs2015_runtime的C ++ 2015和anaconda,我尝试手动安装C ++ 2015。我得到它已经安装的错误,而不是:C++ 2015 won't install然后我尝试在anaconda中安装vs2013_runtime,这将无法解决问题。我卸载了它。然后我尝试从anaconda卸载vs2015,但它是一个关键的包,它不会卸载。

我已经读过这个答案https://github.com/stan-dev/pystan/issues/306(特别是用户总结步骤的最后一条消息),因为那里提到了“msvccompiler”,但我认为他们面临的问题是不同的。

我没有想法。谢谢你的阅读!

python windows visual-c++ anaconda
1个回答
0
投票

我也在努力解决这个问题。我试图编译一个C文件。它确实适用于Python 2.7(Windows 2012 Server中的Anaconda 2),但对于Python 3.7,我遇到了您报告的相同问题。我解决了安装Visual Studio Build Tools 2017的问题。一旦安装它,问题就消失了,编译工作正常。看(https://wiki.python.org/moin/WindowsCompilers

希望这有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.