为 Python 2.7 构建/安装 C 模块时出错 [英] Errors while building/installing C module for Python 2.7

查看:75
本文介绍了为 Python 2.7 构建/安装 C 模块时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试安装/编译时遇到以下错误 ctools for python(版本信息)

I'm trying getting the following errors while trying to install/compile ctools for python (version info)

ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)] on win32

  • 操作系统:Windows 7 Professional 64 位(Service Pack 1)
  • 已安装:Microsoft Visual C++ 2008 Express Edition
  • 错误:

    building 'deap.cTools' extension
    Traceback (most recent call last):
      File "setup.py", line 40, in <module>
        cmdclass = {'build_py': build_py}
      File "C:\Python27\lib\distutils\core.py", line 152, in setup
        dist.run_commands()
      File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\Python27\lib\distutils\command\install.py", line 563, in run
        self.run_command('build')
      File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\Python27\lib\distutils\command\build.py", line 127, in run
        self.run_command(cmd_name)
      File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\Python27\lib\distutils\command\build_ext.py", line 340, in run
        self.build_extensions()
      File "C:\Python27\lib\distutils\command\build_ext.py", line 449, in build_extensions
        self.build_extension(ext)
      File "C:\Python27\lib\distutils\command\build_ext.py", line 499, in build_extension
        depends=ext.depends)
      File "C:\Python27\lib\distutils\msvc9compiler.py", line 473, in compile
        self.initialize()
      File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
        vc_env = query_vcvarsall(VERSION, plat_spec)
      File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in query_vcvarsall
        raise ValueError(str(list(result.keys())))
    ValueError: [u'path']
    

    我已经按照此处的建议安装了 PyWin,但它没有帮助.如果您能帮我解决这个问题,我将不胜感激.

    I've installed PyWin as suggested in here, but it didn't help. I'd appreciate help sorting out this issue.

    编辑

    尝试安装 scikit-learn

      File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in query_vcvarsall
        raise ValueError(str(list(result.keys())))
    ValueError: [u'path']
    

    推荐答案

    我在我的博客中总结了上面的内容.http://springflex.blogspot.com/2014/02/how-to-fix-valueerror-when-trying-to.html

    I summarized above in my blog. http://springflex.blogspot.com/2014/02/how-to-fix-valueerror-when-trying-to.html

    要安装带有所有必需组件的 Visual Studio 2008 Express Edition:

    To install Visual Studio 2008 Express Edition with all required components:

    1. 安装 Microsoft Visual Studio 2008 速成版.主要的 Visual Studio 2008 Express 安装程序可从(C++ 安装程序名称为 vcsetup.exe)获得:

    1. Install Microsoft Visual Studio 2008 Express Edition. The main Visual Studio 2008 Express installer is available from (the C++ installer name is vcsetup.exe):

    安装 Microsoft Windows SDK.Microsoft Windows SDK 可通过搜索 Microsoft 的下载站点或直接访问:http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en

    Install the Microsoft Windows SDK. The Microsoft Windows SDK is available by searching Microsoft's download site, or by going directly to: http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en

    要验证您是否已安装所有组件,请检查 Microsoft SDK 是否包含 C/C++ 编译器cl.exe"的amd64"版本.这通常安装到

    To verify that you have all installed components, check that the Microsoft SDK contains the "amd64" version of the C/C++ compiler "cl.exe". This is usually installed into

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe
    

  • 将 .../VC/bin/vcvars64.bat 复制到 .../VC/bin/vcvarsamd64.bat

  • copy .../VC/bin/vcvars64.bat to .../VC/bin/vcvarsamd64.bat

    将 .../VC/bin/vcvars64.bat 复制到 .../VC/bin/amd64/vcvarsamd64.bat

    copy .../VC/bin/vcvars64.bat to .../VC/bin/amd64/vcvarsamd64.bat

    这篇关于为 Python 2.7 构建/安装 C 模块时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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