gpt4 book ai didi

python - 为 Python 2.7 构建/安装 C 模块时出错

转载 作者:太空狗 更新时间:2023-10-29 17:52:22 26 4
gpt4 key购买 nike

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

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']

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

编辑

尝试安装 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

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

  1. 安装 Microsoft Visual Studio 2008 Express Edition。主要的 Visual Studio 2008 Express 安装程序可从以下位置获得(C++ 安装程序名称为 vcsetup.exe):

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

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

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe
  4. 复制 .../VC/bin/vcvars64.bat 到 .../VC/bin/vcvarsamd64.bat

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

关于python - 为 Python 2.7 构建/安装 C 模块时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13596407/

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