小编典典

尝试为Windows扩展安装Python时出现值错误

python

我已经安装了Microsoft Visual Studio
2008。我下载了适用于Windows扩展的zip文件Python并将其内容提取到我的Python27文件夹中。现在有一个名为pywin32-214的子文件夹。(这是32部分的问题吗?我使用的是64位系统。)以下是命令行的文字记录:

C:\Python27\pywin32-214>setup.py -q install
Building pywin32 2.7.214.0
Traceback (most recent call last):
  File "C:\Python27\pywin32-214\setup.py", line 2152, in <module>
    ('', ('pywin32.pth',)),
  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\pywin32-214\setup.py", line 1251, in run
    install.run(self)
  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\pywin32-214\setup.py", line 596, in run
    build.run(self)
  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\pywin32-214\setup.py", line 858, in build_extensions
    self.compiler.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_vcvarsal
l
    raise ValueError(str(list(result.keys())))
ValueError: [u'path']

我不知道该怎么做。救命?


阅读 224

收藏
2020-12-20

共1个答案

小编典典

如果您安装的是64位Python:

在启用“ X64编译器和工具”选项的情况下安装“ Microsoft Visual Studio 2008专业版”。

或者,从http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/下载pywin32-214.win-
amd64-py2.7.exe。

2020-12-20