尝试使用 setup.py 安装 Cryptodome 时出现错误消息

Error message when trying to install Cryptodome using setup.py

我在 Windows 7 64 位机器上设置 python 的 cryptodome。我正在使用 setup.py 模块来实现这一点。我使用 setup.py 而不是 pip 的原因是因为我安装它的机器没有外部互联网访问权限,因此 pip 将无法工作。

我已经使用 Windows SDK 安装了 64 位 c++ 编译器,并根据以下 link.

当我 运行 setup.py 时,我收到以下错误消息:

  File "setup.py", line 443, in <module>
    set_compiler_options(package_root, ext_modules)
  File "C:\Python33\cryptodome\pycryptodome-3.8.2\compiler_opt.py", line 304, in
 set_compiler_options
    clang = compiler_is_clang()
  File "C:\Python33\cryptodome\pycryptodome-3.8.2\compiler_opt.py", line 239, in
 compiler_is_clang
    return test_compilation(source, msg="clang")
  File "C:\Python33\cryptodome\pycryptodome-3.8.2\compiler_opt.py", line 82, in
test_compilation
    objects = compiler.compile([fname], extra_postargs=extra_cc_options)
  File "C:\Python33\lib\distutils\msvc9compiler.py", line 461, in compile
    self.initialize()
  File "C:\Python33\lib\distutils\msvc9compiler.py", line 372, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python33\lib\distutils\msvc9compiler.py", line 288, in query_vcvarsal
    raise ValueError(str(list(result.keys())))
ValueError: ['path']

这是看起来与错误相关的代码:

    #looks to contain a set of possible environment variable names
    interesting = set(("include", "lib", "libpath", "path"))


    #populates result with keys and values from actual environment variables
    stdout = stdout.decode("mbcs")
            for line in stdout.split("\n"):
                line = Reg.convert_mbcs(line)
                if '=' not in line:
                    continue
                line = line.strip()
                key, value = line.split('=', 1)
                key = key.lower()
                if key in interesting:
                    if value.endswith(os.pathsep):
                        value = value[:-1]
                    result[key] = removeDuplicates(value)


    #tests whether all the keys within result are in interesting
    if len(result) != len(interesting):
         raise ValueError(str(list(result.keys())))

这可能是由于环境变量中缺少某些值造成的吗?如果是这样,那些值应该是什么?

虽然错误消息不是很有帮助,但我通过将 3 个值:lib、include、libpath(路径已添加)添加到机器上的环境变量来修复此问题。