python - 尝试构建基本的 python 扩展示例失败 (windows)

标签 python c build distutils

我在 Win7 x64 机器上运行 Python 2.6 和 Visual Studio 2008。 当我尝试在 python 2.6 源分发中找到的 c“example_nt”中构建基本的 python 扩展示例时,它失败了:

python setup.py build

这导致:

running build
running build_ext
building 'aspell' extension
Traceback (most recent call last):
  File "setup.py", line 7, in <module>
    ext_modules = [module1])
  File "C:\Python26\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python26\lib\distutils\dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\build.py", line 134, in run
    self.run_command(cmd_name)
  File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\build_ext.py", line 343, in run
    self.build_extensions()
  File "C:\Python26\lib\distutils\command\build_ext.py", line 469, in build_extensions
self.build_extension(ext)
  File "C:\Python26\lib\distutils\command\build_ext.py", line 534, in build_extension
depends=ext.depends)
  File "C:\Python26\lib\distutils\msvc9compiler.py", line 448, in compile
self.initialize()
  File "C:\Python26\lib\distutils\msvc9compiler.py", line 358, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python26\lib\distutils\msvc9compiler.py", line 274, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: [u'path']

我该怎么做才能解决这个问题?任何帮助将不胜感激

最佳答案

对于Win7 x64机器Python 2.6(x64)机器,需要安装
适用于 Windows 7 和 .NET Framework 3.5 SP1 的 Microsoft Windows SDK
请参阅
中的说明 http://wiki.cython.org/64BitCythonExtensionsOnWindows

商业 Visual Studio 2008 适用于 Python 2.6、2.7 和 2.8 在 32 位 x86 设置上。

关于python - 尝试构建基本的 python 扩展示例失败 (windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4635734/

相关文章:

python - 选择性 python 字符串替换

python - 将文件夹中的许多 Feather 文件加载到 dask 中

python - 一起计算注释字段

iphone - 从分数到小数再返回?

c - 关于x86-64汇编语言中的局部变量寄存器的问题

python - 无法构建 boost_python 示例代码 "fatal error LNK1181: cannot open input file ' boost_python.lib'"

c++ - 如何通过 g++-arm-linux-gnueabihf 为 Arm 构建 Qt?

java - 跳过 Maven 构建未修改的模块?

python - 用 python 中的枕头分离/重新定位/翻译图像中的形状

c - glCreateShader 正在崩溃