AttributeError:尝试安装numpy扩展时,"MSVCCompiler"对象没有属性"compiler" [英] AttributeError: 'MSVCCompiler' object has no attribute 'compiler' when trying to install a numpy extension

查看:222
本文介绍了AttributeError:尝试安装numpy扩展时,"MSVCCompiler"对象没有属性"compiler"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装numpy扩展 py_find_1st 1.1时遇到问题. 3 .当我尝试通过Windows上的cmd安装它时,收到以下消息:

I'm having an issue when installing the numpy extension py_find_1st 1.1.3. When I try to install it via cmd on Windows, I get the following message:

D:\Chrome dl\py_find_1st-1.0.6\py_find_1st-1.0.6>python setup.py install
running install
running bdist_egg
running egg_info
writing top-level names to py_find_1st.egg-info\top_level.txt
writing dependency_links to py_find_1st.egg-info\dependency_links.txt
writing py_find_1st.egg-info\PKG-INFO
reading manifest file 'py_find_1st.egg-info\SOURCES.txt'
writing manifest file 'py_find_1st.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
Traceback (most recent call last):
  File "setup.py", line 117, in <module>
    zip_safe = False,
  File "D:\Anaconda\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "D:\Anaconda\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install.py", line 67, in run
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install.py", line 109, in do_egg_install
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\bdist_egg.py", line 161, in run
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\bdist_egg.py", line 147, in call_command
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\site-packages\setuptools-27.2.0-py3.5.egg\setuptools\command\install_lib.py", line 11, in run
  File "D:\Anaconda\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "D:\Anaconda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anaconda\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "D:\Anaconda\lib\distutils\command\build_ext.py", line 338, in run
    self.build_extensions()
  File "setup.py", line 42, in build_extensions
    if compiler_is_clang(self.compiler.compiler):
AttributeError: 'MSVCCompiler' object has no attribute 'compiler'

我不了解C或Fortran,但如果我对C或Fortran的理解不正确,通常会使用这些语言创建numpy扩展.有人告诉我我可能需要在计算机上安装编译器,因此我安装了Visual Studio 2017,但仍然收到相同的消息.

I have no knowledge of C or Fortran but if I understand it correctly, numpy extensions are often created using these languages. I was told that I might need a compiler installed on my computer and thus I installed Visual Studio 2017 but I still get the same message.

有人知道成功安装此扩展程序的方法吗?

Does anybody know a way to successfully install this extension?

P.S:在命令提示符下识别出"cl"命令.

P.S: The "cl" command is recognized on the command prompt.

推荐答案

对于将来遇到此问题的人们来说,这不是一个答案,而更多的是提醒:

This is less of an answer and more of a heads up for people running into this in the future:

根据此链接,编译器是[GNU上的属性/] Linux,但不是Windows."因此,每当您遇到此问题时,安装脚本很可能出了点问题.软件包作者很可能没有考虑Windows安装例程,因此需要通知.

According to this link, "compiler is an attribute on [GNU/]Linux but not Windows." Thus, it's highly likely that something is wrong with the setup scripts whenever you run into this problem. Most probably, the package author didn't consider Windows installation routines and needs to be notified.

如果您想自己解决此问题,建议您在setup.py文件中的任何包含"self.compiler.compiler [0]"部分的行中进行注释并将其注释掉.

If you want to fix this yourself, I recommend looking for any line of your setup.py file containing the "self.compiler.compiler[0]" part and commenting it out.

这篇关于AttributeError:尝试安装numpy扩展时,"MSVCCompiler"对象没有属性"compiler"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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